]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added 'store_log_tags' cache manager page. It reports counts of tags that
authorwessels <>
Sat, 14 Apr 2007 05:12:31 +0000 (05:12 +0000)
committerwessels <>
Sat, 14 Apr 2007 05:12:31 +0000 (05:12 +0000)
appear in store.log.

src/main.cc
src/protos.h
src/store_log.cc

index 3f15e7378b374af516c8e620852fc19391b9acc1..48194e404b24ab2fd712cd79a4b0678a06f979df 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.443 2007/04/13 04:52:19 rousskov Exp $
+ * $Id: main.cc,v 1.444 2007/04/13 23:12:31 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -962,6 +962,7 @@ mainInitialize(void)
         storeDigestRegisterWithCacheManager(manager);
         StoreFileSystem::RegisterAllFsWithCacheManager(manager);
         storeRegisterWithCacheManager(manager);
+       storeLogRegisterWithCacheManager(manager);
 #if DEBUGSTRINGS
 
         StringRegistry::Instance().registerWithCacheManager(manager);
index 1b94dab66a1571e0ca0986207553bc624f64c8b6..4e14eb9bbb8fe61c2ac17728f4c2051088d8e89e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.538 2007/04/13 22:46:03 wessels Exp $
+ * $Id: protos.h,v 1.539 2007/04/13 23:12:31 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -520,6 +520,7 @@ SQUIDCEXTERN void storeLog(int tag, const StoreEntry * e);
 SQUIDCEXTERN void storeLogRotate(void);
 SQUIDCEXTERN void storeLogClose(void);
 SQUIDCEXTERN void storeLogOpen(void);
+SQUIDCEXTERN void storeLogRegisterWithCacheManager(CacheManager &);
 
 
 /*
index 52ef763f012c206f57edf43ed409642c8035d91f..b4c76d7808e9c2482a009a110bb66a7b21299a94 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_log.cc,v 1.28 2003/07/14 14:16:02 robertc Exp $
+ * $Id: store_log.cc,v 1.29 2007/04/13 23:12:31 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Logging Functions
  * AUTHOR: Duane Wessels
@@ -37,6 +37,7 @@
 #include "Store.h"
 #include "MemObject.h"
 #include "HttpReply.h"
+#include "CacheManager.h"
 
 static const char *storeLogTags[] =
     {
@@ -47,6 +48,9 @@ static const char *storeLogTags[] =
         "SO_FAIL",
     };
 
+static int storeLogTagsCounts[STORE_LOG_SWAPOUTFAIL+1];
+static OBJH storeLogTagsHist;
+
 static Logfile *storelog = NULL;
 
 void
@@ -65,6 +69,7 @@ storeLog(int tag, const StoreEntry * e)
 
 #endif
 
+    storeLogTagsCounts[tag]++;
     if (mem != NULL) {
         if (mem->log_url == NULL) {
             debug(20, 1) ("storeLog: NULL log_url for %s\n", mem->url);
@@ -136,3 +141,22 @@ storeLogOpen(void)
 
     storelog = logfileOpen(Config.Log.store, 0, 1);
 }
+
+void
+storeLogRegisterWithCacheManager(CacheManager & manager)
+{
+    manager.registerAction("store_log_tags",
+       "Histogram of store.log tags",
+       storeLogTagsHist, 0, 1);
+}
+
+void
+storeLogTagsHist(StoreEntry *e)
+{
+    int tag;
+    for (tag = 0; tag <= STORE_LOG_SWAPOUTFAIL; tag++) {
+       storeAppendPrintf(e, "%s %d\n",
+           storeLogTags[tag],
+           storeLogTagsCounts[tag]);
+    }
+}