From: Alex Rousskov Date: Tue, 12 Apr 2011 22:58:25 +0000 (-0600) Subject: Added basic stats reporting. X-Git-Tag: take06~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4e688b7b851b9accc082a210fd0efb131cc696f;p=thirdparty%2Fsquid.git Added basic stats reporting. --- diff --git a/src/MemStore.cc b/src/MemStore.cc index a9c2afe8a4..b8f0d0760d 100644 --- a/src/MemStore.cc +++ b/src/MemStore.cc @@ -39,10 +39,27 @@ MemStore::init() } void -MemStore::stat(StoreEntry &output) const +MemStore::stat(StoreEntry &e) const { - storeAppendPrintf(&output, "Memory Cache"); - // TODO: implement + storeAppendPrintf(&e, "\n\nShared Memory Cache\n"); + + storeAppendPrintf(&e, "Maximum Size: %.0f KB\n", Config.memMaxSize/1024.0); + + if (map) { + const int limit = map->entryLimit(); + storeAppendPrintf(&e, "Maximum entries: %9d\n", limit); + if (limit > 0) { + const int entryCount = map->entryCount(); + storeAppendPrintf(&e, "Current entries: %9d %.2f%%\n", + entryCount, (100.0 * entryCount / limit)); + + if (limit < 100) { // XXX: otherwise too expensive to count + Ipc::ReadWriteLockStats stats; + map->updateStats(stats); + stats.dump(e); + } + } + } } void