From: wessels <> Date: Sat, 14 Apr 2007 05:12:31 +0000 (+0000) Subject: Added 'store_log_tags' cache manager page. It reports counts of tags that X-Git-Tag: SQUID_3_0_PRE6~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91fabb0654bf9ff6dac1810027514fed4f389145;p=thirdparty%2Fsquid.git Added 'store_log_tags' cache manager page. It reports counts of tags that appear in store.log. --- diff --git a/src/main.cc b/src/main.cc index 3f15e7378b..48194e404b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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); diff --git a/src/protos.h b/src/protos.h index 1b94dab66a..4e14eb9bbb 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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 &); /* diff --git a/src/store_log.cc b/src/store_log.cc index 52ef763f01..b4c76d7808 100644 --- a/src/store_log.cc +++ b/src/store_log.cc @@ -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]); + } +}