]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added basic stats reporting.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 12 Apr 2011 22:58:25 +0000 (16:58 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 12 Apr 2011 22:58:25 +0000 (16:58 -0600)
src/MemStore.cc

index a9c2afe8a43a0a9880cbdcb0f119438f1bcc106d..b8f0d0760dc327b1fb4f1ce368a33171c961b43b 100644 (file)
@@ -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