]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Glenn
authorwessels <>
Thu, 6 Jan 2000 05:44:00 +0000 (05:44 +0000)
committerwessels <>
Thu, 6 Jan 2000 05:44:00 +0000 (05:44 +0000)
 - Adds counters for disk hits and memory hits.

src/client_side.cc
src/protos.h
src/stat.cc
src/structs.h

index f24a8ced7aa52a30aebc6e00cba4fef27f8ee0d0..668ae8780323bc761fc65ef64abdc6d99272d170 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.466 2000/01/05 06:22:19 wessels Exp $
+ * $Id: client_side.cc,v 1.467 2000/01/05 22:44:00 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -578,6 +578,10 @@ clientUpdateCounters(clientHttpRequest * http)
     Counter.client_http.requests++;
     if (isTcpHit(http->log_type))
        Counter.client_http.hits++;
+    if (http->log_type == LOG_TCP_HIT)
+       Counter.client_http.disk_hits++;
+    else if (http->log_type == LOG_TCP_MEM_HIT)
+       Counter.client_http.mem_hits++;
     if (http->request->err_type != ERR_NONE)
        Counter.client_http.errors++;
     statHistCount(&Counter.client_http.all_svc_time, svc_time);
index 7f4f2ffdab5545a48ba3e687fc530d7fc5420451..f42f4b58e1d320cbc93505880d8e4900789b9e40 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.350 2000/01/05 06:23:45 wessels Exp $
+ * $Id: protos.h,v 1.351 2000/01/05 22:44:01 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -728,6 +728,8 @@ extern int stat5minClientRequests(void);
 extern double stat5minCPUUsage(void);
 extern const char *storeEntryFlags(const StoreEntry *);
 extern double statRequestHitRatio(int minutes);
+extern double statRequestHitMemoryRatio(int minutes);
+extern double statRequestHitDiskRatio(int minutes);
 extern double statByteHitRatio(int minutes);
 
 
index dcb7694d145b28dd909eff33a650e71882343158..5e9ef651ec29bcf927b01f4ed6874fcd4559231d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.322 1999/12/30 17:36:52 wessels Exp $
+ * $Id: stat.cc,v 1.323 2000/01/05 22:44:02 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -485,6 +485,12 @@ info_get(StoreEntry * sentry)
     storeAppendPrintf(sentry, "\tByte Hit Ratios:\t5min: %3.1f%%, 60min: %3.1f%%\n",
        statByteHitRatio(5),
        statByteHitRatio(60));
+    storeAppendPrintf(sentry, "\tRequest Memory Hit Ratios:\t5min: %3.1f%%, 60min: %3.1f%%\n",
+       statRequestHitMemoryRatio(5),
+       statRequestHitMemoryRatio(60));
+    storeAppendPrintf(sentry, "\tRequest Disk Hit Ratios:\t5min: %3.1f%%, 60min: %3.1f%%\n",
+       statRequestHitDiskRatio(5),
+       statRequestHitDiskRatio(60));
     storeAppendPrintf(sentry, "\tStorage Swap size:\t%d KB\n",
        store_swap_size);
     storeAppendPrintf(sentry, "\tStorage Mem size:\t%d KB\n",
@@ -1289,6 +1295,26 @@ statRequestHitRatio(int minutes)
        CountHist[minutes].client_http.requests);
 }
 
+extern double
+statRequestHitMemoryRatio(int minutes)
+{
+    assert(minutes < N_COUNT_HIST);
+    return dpercent(CountHist[0].client_http.mem_hits -
+       CountHist[minutes].client_http.mem_hits,
+       CountHist[0].client_http.hits -
+       CountHist[minutes].client_http.hits);
+}
+
+extern double
+statRequestHitDiskRatio(int minutes)
+{
+    assert(minutes < N_COUNT_HIST);
+    return dpercent(CountHist[0].client_http.disk_hits -
+       CountHist[minutes].client_http.disk_hits,
+       CountHist[0].client_http.hits -
+       CountHist[minutes].client_http.hits);
+}
+
 extern double
 statByteHitRatio(int minutes)
 {
index 7e23782033aa92b842d758c06ecc455a7e4d2e5a..80f89433de478dcb77a6b6f68961472d266e15b5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.308 1999/12/30 17:37:00 wessels Exp $
+ * $Id: structs.h,v 1.309 2000/01/05 22:44:03 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -1550,6 +1550,8 @@ struct _StatCounters {
        int clients;
        int requests;
        int hits;
+       int mem_hits;
+       int disk_hits;
        int errors;
        kb_t kbytes_in;
        kb_t kbytes_out;