summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-10-06 10:09:24 -0700
committerMark Salyzyn <salyzyn@google.com>2016-11-04 07:43:16 -0700
commitb0672290e320113f4b6d8fc6bb2d1e0afe493c5c (patch)
tree41d7665bcb05a30418e4d6b1ccd195bf195302fb
parent6d981af12023bcaf22bfa0612a85ae4580ecb971 (diff)
downloadsystem_core-b0672290e320113f4b6d8fc6bb2d1e0afe493c5c.tar.gz
system_core-b0672290e320113f4b6d8fc6bb2d1e0afe493c5c.tar.bz2
system_core-b0672290e320113f4b6d8fc6bb2d1e0afe493c5c.zip
logd: report last prune memory overhead
An estimate based on chatty impact for all known pids, uids and tags and per log id if applicable, calculate the maximum last pruned watermark iterator map usage and add to the Total Overhead. Test: Confirm that the Total Overhead change is negligable. Bug: 31942525 Change-Id: Icd2e9bc0747c3376ca0e9c90aa110c103529d98f
-rw-r--r--logd/LogStatistics.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
index 69fe91502..1f598af8a 100644
--- a/logd/LogStatistics.h
+++ b/logd/LogStatistics.h
@@ -59,10 +59,12 @@ class LogHashtable {
public:
+ size_t size() const { return map.size(); }
+
// Estimate unordered_map memory usage.
size_t sizeOf() const {
return sizeof(*this) +
- (map.size() * (sizeof(TEntry) + unordered_map_per_entry_overhead)) +
+ (size() * (sizeof(TEntry) + unordered_map_per_entry_overhead)) +
(bucket_size() * sizeof(size_t) + unordered_map_bucket_overhead);
}
@@ -497,7 +499,9 @@ class LogStatistics {
size_t sizeOf() const {
size_t size = sizeof(*this) + pidTable.sizeOf() + tidTable.sizeOf() +
- tagTable.sizeOf() + securityTagTable.sizeOf();
+ tagTable.sizeOf() + securityTagTable.sizeOf() +
+ (pidTable.size() * sizeof(pidTable_t::iterator)) +
+ (tagTable.size() * sizeof(tagTable_t::iterator));
for(auto it : pidTable) {
const char* name = it.second.getName();
if (name) size += strlen(name) + 1;
@@ -508,7 +512,9 @@ class LogStatistics {
}
log_id_for_each(id) {
size += uidTable[id].sizeOf();
+ size += uidTable[id].size() * sizeof(uidTable_t::iterator);
size += pidSystemTable[id].sizeOf();
+ size += pidSystemTable[id].size() * sizeof(pidSystemTable_t::iterator);
}
return size;
}