]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Wed, 4 Oct 2000 02:51:04 +0000 (02:51 +0000)
committerwessels <>
Wed, 4 Oct 2000 02:51:04 +0000 (02:51 +0000)
 - This ugly hack is here to prevent the user from seeing a negative
   byte hit ratio.  When we fetch a cache digest from a neighbor,
   it gets treated like a cache miss because the object is consumed
   internally.  Thus, we subtract cache digest bytes out before
   calculating the byte hit ratio.

src/stat.cc

index 8a2a8fc1d1dbba04e9adbce85c8683ebfc0c2fc9..515a7d2103f4317233153496719f56cff53a7298 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.334 2000/09/05 19:40:18 wessels Exp $
+ * $Id: stat.cc,v 1.335 2000/10/03 20:51:04 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -1347,10 +1347,25 @@ statByteHitRatio(int minutes)
 {
     size_t s;
     size_t c;
+#if USE_CACHE_DIGESTS
+    size_t cd;
+#endif
+    /* size_t might be unsigned */
     assert(minutes < N_COUNT_HIST);
     c = CountHist[0].client_http.kbytes_out.kb - CountHist[minutes].client_http.kbytes_out.kb;
     s = CountHist[0].server.all.kbytes_in.kb - CountHist[minutes].server.all.kbytes_in.kb;
-    /* size_t might be unsigned */
+#if USE_CACHE_DIGESTS
+    /*
+     * This ugly hack is here to prevent the user from seeing a
+     * negative byte hit ratio.  When we fetch a cache digest from
+     * a neighbor, it gets treated like a cache miss because the
+     * object is consumed internally.  Thus, we subtract cache
+     * digest bytes out before calculating the byte hit ratio.
+     */
+    cd = CountHist[0].cd.kbytes_recv.kb - CountHist[minutes].cd.kbytes_recv.kb;
+    assert(s > cd);
+    s -= cd;
+#endif
     if (c > s)
        return dpercent(c - s, c);
     else