]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- added cd.on_xition_count histogram to Counter
authorrousskov <>
Tue, 14 Apr 1998 22:38:21 +0000 (22:38 +0000)
committerrousskov <>
Tue, 14 Apr 1998 22:38:21 +0000 (22:38 +0000)
  counts the number of 0->1 transitions during cacheDigestAdd()

src/CacheDigest.cc
src/globals.h
src/stat.cc
src/structs.h

index 43fd747960209180f38c2f9019a6122baed791b2..799b457c5fa6b3dda875cc51b63d982459ed9e74 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: CacheDigest.cc,v 1.12 1998/04/14 15:16:23 rousskov Exp $
+ * $Id: CacheDigest.cc,v 1.13 1998/04/14 16:38:21 rousskov Exp $
  *
  * DEBUG: section 70    Cache Digest
  * AUTHOR: Alex Rousskov
@@ -131,10 +131,33 @@ cacheDigestAdd(CacheDigest * cd, const cache_key * key)
     /* hash */
     cacheDigestHashKey(cd, key);
     /* turn on corresponding bits */
+#if CD_FAST_ADD
     CBIT_SET(cd->mask, hashed_keys[0]);
     CBIT_SET(cd->mask, hashed_keys[1]);
     CBIT_SET(cd->mask, hashed_keys[2]);
     CBIT_SET(cd->mask, hashed_keys[3]);
+#else
+    {
+       int on_xition_cnt = 0;
+       if (!CBIT_TEST(cd->mask, hashed_keys[0])) {
+           CBIT_SET(cd->mask, hashed_keys[0]);
+           on_xition_cnt++;
+       }
+       if (!CBIT_TEST(cd->mask, hashed_keys[1])) {
+           CBIT_SET(cd->mask, hashed_keys[1]);
+           on_xition_cnt++;
+       }
+       if (!CBIT_TEST(cd->mask, hashed_keys[2])) {
+           CBIT_SET(cd->mask, hashed_keys[2]);
+           on_xition_cnt++;
+       }
+       if (!CBIT_TEST(cd->mask, hashed_keys[3])) {
+           CBIT_SET(cd->mask, hashed_keys[3]);
+           on_xition_cnt++;
+       }
+       statHistCount(&Counter.cd.on_xition_count, on_xition_cnt);
+    }
+#endif
     cd->count++;
 }
 
index 2932b1e1a137eb68809d844755ab17e3601325cf..a29dac2c2f392e4b21b13f33f8851932278cb1de 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.51 1998/04/07 23:29:55 rousskov Exp $
+ * $Id: globals.h,v 1.52 1998/04/14 16:38:22 rousskov Exp $
  */
 
 extern FILE *debug_log;                /* NULL */
@@ -98,6 +98,7 @@ extern dlink_list store_list;
 extern const String StringNull;        /* { 0, 0, NULL } */
 extern int hot_obj_count;      /* 0 */
 extern int _db_level;
+extern const int CacheDigestHashCount; /* 4 */
 extern CacheDigest *store_digest; /* NULL */
 extern const char *StoreDigestUrlPath; /* "store_digest" */
 extern const char *StoreDigestMimeStr; /* "application/cache-digest" */
index bad9998dec88771ff90ede1f903e4d003a5d5a17..55daed727b89ed75bf0cb804051ac4b69b5ee882 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.237 1998/04/12 06:10:08 rousskov Exp $
+ * $Id: stat.cc,v 1.238 1998/04/14 16:38:23 rousskov Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -880,6 +880,7 @@ statCountersInitSpecial(StatCounters * C)
     statHistLogInit(&C->icp.server_svc_time, 300, 0.0, 3600000.0 * 30.0);
     statHistEnumInit(&C->cd.peer_choice_count, Config.npeers);
     statHistEnumInit(&C->cd.peer_ichoice_count, Config.npeers);
+    statHistEnumInit(&C->cd.on_xition_count, CacheDigestHashCount);
 #endif
 }
 
@@ -902,6 +903,7 @@ statCountersClean(StatCounters * C)
     statHistClean(&C->icp.server_svc_time);
     statHistClean(&C->cd.peer_choice_count);
     statHistClean(&C->cd.peer_ichoice_count);
+    statHistClean(&C->cd.on_xition_count);
 #endif
 }
 
@@ -930,6 +932,7 @@ statCountersCopy(StatCounters * dest, const StatCounters * orig)
     statHistCopy(&dest->icp.server_svc_time, &orig->icp.server_svc_time);
     statHistCopy(&dest->cd.peer_choice_count, &orig->cd.peer_choice_count);
     statHistCopy(&dest->cd.peer_ichoice_count, &orig->cd.peer_ichoice_count);
+    statHistCopy(&dest->cd.on_xition_count, &orig->cd.on_xition_count);
 #endif
 }
 
@@ -960,6 +963,8 @@ statCountersHistograms(StoreEntry *sentry)
     statHistDump(&f->cd.peer_choice_count, sentry, &statHistIntDumper);
     storeAppendPrintf(sentry, "\ncd.peer_ichoice_count histogram:\n");
     statHistDump(&f->cd.peer_ichoice_count, sentry, &statHistIntDumper);
+    storeAppendPrintf(sentry, "\ncd.on_xition_count histogram:\n");
+    statHistDump(&f->cd.on_xition_count, sentry, &statHistIntDumper);
 #endif
 #if TOO_MUCH_OUTPUT
     storeAppendPrintf(sentry, "icp.query_svc_time histogram:\n");
index 4af591073ead92193f252244ab948ecb1d6e3ca4..2c007fc1b3ffc526ca8e405d2962a84072f3e6f3 100644 (file)
@@ -1222,8 +1222,9 @@ struct _StatCounters {
         cd_guess_stats guess;
        StatHist client_svc_time;
        StatHist server_svc_time;
-       StatHist peer_choice_count;
-       StatHist peer_ichoice_count;
+       StatHist peer_choice_count;  /* #peer select choices in peerSelectFoo */
+       StatHist peer_ichoice_count; /* #peer select choices with rtt > 0 */
+       StatHist on_xition_count;    /* #(0->1) transitions during cacheDigestAdd */
     } cd;
 #endif
     int page_faults;