]> granicus.if.org Git - pdns/commitdiff
improve soft-calculated memory use statistics accuracy
authorBert Hubert <bert.hubert@netherlabs.nl>
Tue, 14 Dec 2010 13:14:55 +0000 (13:14 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Tue, 14 Dec 2010 13:14:55 +0000 (13:14 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1748 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/recursor_cache.cc
pdns/recursor_cache.hh

index 0c5f4f80c9ef1968931b213503b32a15bf58dd16..dcbf23743fc15827242e78578504d9bdbad2eff7 100644 (file)
@@ -95,6 +95,7 @@ unsigned int MemRecursorCache::bytes()
   unsigned int ret=0;
 
   for(cache_t::const_iterator i=d_cache.begin(); i!=d_cache.end(); ++i) {
+    ret+=sizeof(struct CacheEntry);
     ret+=(unsigned int)i->d_qname.length();
     for(vector<StoredRecord>::const_iterator j=i->d_records.begin(); j!= i->d_records.end(); ++j)
       ret+=j->size();
index 5ddf93a8589536d5c41230578dd23c5c9a522df5..f7c9bbb5edcad1625600c6625bbf396dbf7d36dd 100644 (file)
@@ -57,7 +57,7 @@ private:
 
     unsigned int size() const
     {
-      return ( unsigned int ) 4+d_string.size();
+      return sizeof(*this) + d_string.size();
     }
 
   };