From: wessels <> Date: Wed, 7 Oct 1998 00:32:41 +0000 (+0000) Subject: add 5/60 minute byte/request hit ratios to info page X-Git-Tag: SQUID_3_0_PRE1~2607 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=491a980bd328a920c15ca8fccf69a07fddcec6a5;p=thirdparty%2Fsquid.git add 5/60 minute byte/request hit ratios to info page --- diff --git a/src/stat.cc b/src/stat.cc index 56a06540cf..67b9c55575 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.294 1998/09/23 20:13:54 wessels Exp $ + * $Id: stat.cc,v 1.295 1998/10/06 18:32:41 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -76,6 +76,8 @@ static OBJH statAvg5min; static OBJH statAvg60min; static OBJH statUtilization; static OBJH statCountersHistograms; +static double statRequestHitRatio(int minutes); +static double statByteHitRatio(int minutes); #ifdef XMALLOC_STATISTICS static void info_get_mallstat(int, int, StoreEntry *); @@ -464,6 +466,12 @@ info_get(StoreEntry * sentry) storeAppendPrintf(sentry, "Cache information for %s:\n", appname); + storeAppendPrintf(sentry, "\tRequest Hit Ratios:\t5min: %3.1f%%, 60min: %3.1f%%\n", + statRequestHitRatio(5), + statRequestHitRatio(60)); + storeAppendPrintf(sentry, "\tByte Hit Ratios:\t5min: %3.1f%%, 60min: %3.1f%%\n", + statByteHitRatio(5), + statByteHitRatio(60)); storeAppendPrintf(sentry, "\tStorage Swap size:\t%d KB\n", store_swap_size); storeAppendPrintf(sentry, "\tStorage Mem size:\t%d KB\n", @@ -1260,6 +1268,27 @@ statCPUUsage(int minutes) tvSubDsec(CountHist[minutes].timestamp, CountHist[0].timestamp)); } +static double +statRequestHitRatio(int minutes) +{ + assert(minutes < N_COUNT_HIST); + return dpercent(CountHist[0].client_http.hits - + CountHist[minutes].client_http.hits, + CountHist[0].client_http.requests - + CountHist[minutes].client_http.requests); +} + +static double +statByteHitRatio(int minutes) +{ + size_t s; + size_t c; + 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; + return dpercent(c - s, c); +} + #if STAT_GRAPHS /* * urgh, i don't like these, but they do cut the amount of code down immensely