Changeset 1750

Show
Ignore:
Timestamp:
12/14/10 14:35:44 (2 years ago)
Author:
ahu
Message:

implement & document packetcache-bytes and cache-bytes, which return the estimated pre-malloc bytesize usage of these caches

Location:
trunk/pdns/pdns
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/docs/pdns.sgml

    r1728 r1750  
    98089808answers1-10         counts the number of queries answered within 10 miliseconds 
    98099809answers-slow        counts the number of queries answered after 1 second 
     9810cache-bytes         Size of the cache in bytes (since 3.3.1) 
    98109811cache-entries       shows the number of entries in the cache 
    98119812cache-hits          counts the number of cache hits since starting 
     
    98249825outgoing-timeouts   counts the number of timeouts on outgoing UDP queries since starting 
    98259826over-capacity-drops Questions dropped because over maximum concurrent query limit (since 3.2) 
     9827packetcache-bytes   Size of the packet cache in bytes (since 3.3.1) 
    98269828packetcache-entries Size of packet cache (since 3.2) 
    98279829packetcache-hits    Packet cache hits (since 3.2) 
  • trunk/pdns/pdns/rec_channel_rec.cc

    r1745 r1750  
    299299} 
    300300 
     301uint64_t* pleaseGetCacheBytes() 
     302{ 
     303  return new uint64_t(t_RC->bytes()); 
     304} 
     305 
     306 
    301307uint64_t doGetCacheSize() 
    302308{ 
     
    304310} 
    305311 
     312uint64_t doGetCacheBytes() 
     313{ 
     314  return broadcastAccFunction<uint64_t>(pleaseGetCacheBytes); 
     315} 
     316 
    306317uint64_t* pleaseGetCacheHits() 
    307318{ 
     
    325336 
    326337 
    327  
    328  
    329338uint64_t* pleaseGetPacketCacheSize() 
    330339{ 
     
    332341} 
    333342 
     343uint64_t* pleaseGetPacketCacheBytes() 
     344{ 
     345  return new uint64_t(t_packetCache->bytes()); 
     346} 
     347 
     348 
    334349uint64_t doGetPacketCacheSize() 
    335350{ 
     
    337352} 
    338353 
     354uint64_t doGetPacketCacheBytes() 
     355{ 
     356  return broadcastAccFunction<uint64_t>(pleaseGetPacketCacheBytes); 
     357} 
     358 
     359 
    339360uint64_t* pleaseGetPacketCacheHits() 
    340361{ 
     
    357378} 
    358379 
     380uint64_t doGetMallocated() 
     381{ 
     382  // this turned out to be broken 
     383/*  struct mallinfo mi = mallinfo(); 
     384  return mi.uordblks; */ 
     385  return 0; 
     386} 
    359387 
    360388RecursorControlParser::RecursorControlParser() 
     
    366394  addGetStat("cache-misses", doGetCacheMisses);  
    367395  addGetStat("cache-entries", doGetCacheSize);  
     396  addGetStat("cache-bytes", doGetCacheBytes);  
    368397   
    369398  addGetStat("packetcache-hits", doGetPacketCacheHits); 
    370399  addGetStat("packetcache-misses", doGetPacketCacheMisses);  
    371400  addGetStat("packetcache-entries", doGetPacketCacheSize);  
    372    
    373    
     401  addGetStat("packetcache-bytes", doGetPacketCacheBytes);  
     402   
     403  addGetStat("malloc-bytes", doGetMallocated); 
    374404   
    375405  addGetStat("servfail-answers", &g_stats.servFails); 
     
    457487static void doExitNicely() 
    458488{ 
     489  //extern void printCallers(); 
     490  // printCallers(); 
    459491  doExitGeneric(true); 
    460492} 
     
    531563    *command=&doExitNicely; 
    532564    return "bye nicely\n"; 
    533   } 
    534    
     565  }   
    535566 
    536567  if(cmd=="dump-cache")  
     
    578609    return reloadAuthAndForwards(); 
    579610  } 
    580  
     611   
    581612  return "Unknown command '"+cmd+"'\n"; 
    582613} 
  • trunk/pdns/pdns/recpacketcache.cc

    r1705 r1750  
    11#include <iostream> 
     2#include <boost/foreach.hpp> 
    23#include "recpacketcache.hh" 
    34#include "cachecleaner.hh" 
     
    6364} 
    6465 
     66uint64_t RecursorPacketCache::bytes() 
     67{ 
     68  uint64_t sum=0; 
     69  BOOST_FOREACH(const struct Entry& e, d_packetCache) { 
     70    sum += sizeof(e) + e.d_packet.length() + 4; 
     71  } 
     72  return sum; 
     73} 
     74 
     75 
    6576void RecursorPacketCache::doPruneTo(unsigned int maxCached) 
    6677{ 
  • trunk/pdns/pdns/recpacketcache.hh

    r1702 r1750  
    2727  uint64_t d_hits, d_misses; 
    2828  uint64_t size(); 
     29  uint64_t bytes(); 
    2930 
    3031private: