]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
More cachemanager initialization reshuffling.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 12 Jul 2008 15:11:10 +0000 (17:11 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 12 Jul 2008 15:11:10 +0000 (17:11 +0200)
Worked around fubar with cpu_profile initialization call.

src/ProfStats.cc
src/SquidString.h
src/String.cc
src/forward.cc
src/forward.h
src/fs/coss/StoreFScoss.cc
src/main.cc
src/pconn.cc
src/store_log.cc

index 74cafb185dc8829c8d72008fec328c996a2a8bf8..0afa1aaa99361d0e3a0eba13e6ea350b24c6ecb7 100644 (file)
@@ -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
index 905a4f607e0b593087a90e0b8701b6b60c8c2c75..db650e3f8962ac80ba5f417a0474409eaef01ed2 100644 (file)
@@ -60,7 +60,7 @@ public:
     void add
         (String const *);
 
-    void registerWithCacheManager(void);
+    StringRegistry();
 
     void remove
         (String const *);
index 102403be7b335cade3a59bde4c2914ea4a9af2d1..72711482012ce5829820fd3df013e12e6f8d2efd 100644 (file)
@@ -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
index 83aabb8d6bfd7c5a9edfb16db251e62c0afffecd..8d61c4dca4a8c223c5e8834ecbae8cd319f5b458 100644 (file)
@@ -1177,6 +1177,8 @@ FwdState::initModule()
         logfile = logfileOpen(Config.Log.forward, 0, 1);
 
 #endif
+
+    RegisterWithCacheManager();
 }
 
 void
index 5124d4ee520039a8020794efd5b7c2d397ab8dbb..3c3b80d2bc595a9269858515451d785209ad4e6c 100644 (file)
@@ -25,7 +25,6 @@ public:
     typedef RefCount<FwdState> 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
 
index 6028eb1b0320ddb72cb077612aaeecd0f6dae8db..6bc7a5d111eb8c0b0bd912dba1b8cfa57407f53c 100644 (file)
@@ -52,6 +52,7 @@ StoreFScoss::GetInstance()
 StoreFScoss::StoreFScoss()
 {
     FsAdd(*this);
+    registerWithCacheManager();
 }
 
 char const *
index a1f1a4ce87cd50a61c1b89a33f59ee71053bab1a..9c4317e03654a6ac86f2bd403bce5f62bbdbbe8a 100644 (file)
@@ -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
index 8895a0a6979a3e74decb31584d0070b58100e2d8..c032d95927367388b10b8c0da32de6a8eba6bcb3 100644 (file)
@@ -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 *
index e370ed659bdc0f317862eb2dde0d45fc8898a1f5..247acd040b5a06ee48e739b43268c82f894f043f 100644 (file)
@@ -127,6 +127,8 @@ storeLogClose(void)
 void
 storeLogOpen(void)
 {
+    storeLogRegisterWithCacheManager();
     if (strcmp(Config.Log.store, "none") == 0) {
         debugs(20, 1, "Store logging disabled");
         return;