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
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
index 69fe915..1f598af 100644
--- a/logd/LogStatistics.h
+++ b/logd/LogStatistics.h
@@ -59,10 +59,12 @@
 
 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 @@
 
     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 @@
         }
         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;
     }