From: wessels <> Date: Wed, 4 Oct 2000 02:51:04 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~1852 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ac342231d8be1b8148ef1482e0aa09e1fa3dee91;p=thirdparty%2Fsquid.git DW: - 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. --- diff --git a/src/stat.cc b/src/stat.cc index 8a2a8fc1d1..515a7d2103 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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