From: Francesco Chemolli Date: Sat, 12 Jul 2008 15:11:10 +0000 (+0200) Subject: More cachemanager initialization reshuffling. X-Git-Tag: SQUID_3_1_0_1~49^2~143^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6852be71bdec49c594ed9941b200dc0cc2835dcd;p=thirdparty%2Fsquid.git More cachemanager initialization reshuffling. Worked around fubar with cpu_profile initialization call. --- diff --git a/src/ProfStats.cc b/src/ProfStats.cc index 74cafb185d..0afa1aaa99 100644 --- a/src/ProfStats.cc +++ b/src/ProfStats.cc @@ -265,18 +265,21 @@ xprof_chk_overhead(int samples) } } +// FIXME: +// this gets colled once per event. This doesn't seem to make much sense, +// does it? static hrtime_t now; static void xprof_Init(void) { - xprofRegisterWithCacheManager(); - if (xprof_inited) return; xprof_delta = xprof_verystart = xprof_start_t = now; xprof_inited = 1; + + xprofRegisterWithCacheManager(); //moved here so it's not double-init'ed } void diff --git a/src/SquidString.h b/src/SquidString.h index 905a4f607e..db650e3f89 100644 --- a/src/SquidString.h +++ b/src/SquidString.h @@ -60,7 +60,7 @@ public: void add (String const *); - void registerWithCacheManager(void); + StringRegistry(); void remove (String const *); diff --git a/src/String.cc b/src/String.cc index 102403be7b..7271148201 100644 --- a/src/String.cc +++ b/src/String.cc @@ -253,11 +253,12 @@ ptrcmp(C const &lhs, C const &rhs) return lhs - rhs; } -void -StringRegistry::registerWithCacheManager(void) +StringRegistry::StringRegistry() { +#if DEBUGSTRINGS CacheManager::GetInstance()->registerAction("strings", "Strings in use in squid", Stat, 0, 1); +#endif } void diff --git a/src/forward.cc b/src/forward.cc index 83aabb8d6b..8d61c4dca4 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1177,6 +1177,8 @@ FwdState::initModule() logfile = logfileOpen(Config.Log.forward, 0, 1); #endif + + RegisterWithCacheManager(); } void diff --git a/src/forward.h b/src/forward.h index 5124d4ee52..3c3b80d2bc 100644 --- a/src/forward.h +++ b/src/forward.h @@ -25,7 +25,6 @@ public: typedef RefCount Pointer; ~FwdState(); static void initModule(); - static void RegisterWithCacheManager(void); static void fwdStart(int fd, StoreEntry *, HttpRequest *); void startComplete(FwdServer *); @@ -66,6 +65,7 @@ private: void updateHierarchyInfo(); void completed(); void retryOrBail(); + static void RegisterWithCacheManager(void); #if WIP_FWD_LOG diff --git a/src/fs/coss/StoreFScoss.cc b/src/fs/coss/StoreFScoss.cc index 6028eb1b03..6bc7a5d111 100644 --- a/src/fs/coss/StoreFScoss.cc +++ b/src/fs/coss/StoreFScoss.cc @@ -52,6 +52,7 @@ StoreFScoss::GetInstance() StoreFScoss::StoreFScoss() { FsAdd(*this); + registerWithCacheManager(); } char const * diff --git a/src/main.cc b/src/main.cc index a1f1a4ce87..9c4317e036 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1001,7 +1001,7 @@ mainInitialize(void) eventInit(); // externalAclRegisterWithCacheManager(); //moved to externalAclInit() // fqdncacheRegisterWithCacheManager(); //moved to fqdncache_init() - FwdState::RegisterWithCacheManager(); + // FwdState::RegisterWithCacheManager(); //moved to FwdState::initModule // httpHeaderRegisterWithCacheManager(); //moved to httpHeaderInitModule #if !USE_DNSSERVERS //TODO: remove cache manager registration functions from namespace @@ -1012,17 +1012,19 @@ mainInitialize(void) // ipcacheRegisterWithCacheManager(); //moved to ipcache_init() // Mem::RegisterWithCacheManager(); //moved to Mem::Init() // netdbRegisterWitHCacheManager(); //moved to netdbInit() - PconnModule::GetInstance()->registerWithCacheManager(); + // TODO: pconn is a good candidate for new-style registration + // PconnModule::GetInstance()->registerWithCacheManager(); + // moved to PconnModule::PconnModule() // redirectRegisterWithCacheManager(); //moved to redirectInit() // refreshRegisterWithCacheManager(); //moved to refreshInit() // statRegisterWithCacheManager(); //moved to statInit() // storeDigestRegisterWithCacheManager(); //moved to storeDigestInit() - StoreFileSystem::RegisterAllFsWithCacheManager(); + // StoreFileSystem::RegisterAllFsWithCacheManager(); // storeRegisterWithCacheManager(); //moved to storeInit() - storeLogRegisterWithCacheManager(); + // storeLogRegisterWithCacheManager(); //moved to storeLogOpen() #if DEBUGSTRINGS - - StringRegistry::Instance().registerWithCacheManager(); + // cpu_prStringRegistry::Instance().registerWithCacheManager(); + // moved to class constructor #endif #if USE_XPROF_STATS diff --git a/src/pconn.cc b/src/pconn.cc index 8895a0a697..c032d95927 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -328,6 +328,7 @@ PconnModule::PconnModule() : pools(NULL), poolCount(0) pools = (PconnPool **) xcalloc(MAX_NUM_PCONN_POOLS, sizeof(*pools)); pconn_fds_pool = memPoolCreate("pconn_fds", PCONN_FDS_SZ * sizeof(int)); debugs(48, 0, "persistent connection module initialized"); + registerWithCacheManager(); } PconnModule * diff --git a/src/store_log.cc b/src/store_log.cc index e370ed659b..247acd040b 100644 --- a/src/store_log.cc +++ b/src/store_log.cc @@ -127,6 +127,8 @@ storeLogClose(void) void storeLogOpen(void) { + storeLogRegisterWithCacheManager(); + if (strcmp(Config.Log.store, "none") == 0) { debugs(20, 1, "Store logging disabled"); return;