From: wessels <> Date: Thu, 6 Jan 2000 05:44:00 +0000 (+0000) Subject: Glenn X-Git-Tag: SQUID_3_0_PRE1~2089 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f4d1d6e888bf2816dcfb100cb0716a6b37e4a9d;p=thirdparty%2Fsquid.git Glenn - Adds counters for disk hits and memory hits. --- diff --git a/src/client_side.cc b/src/client_side.cc index f24a8ced7a..668ae87803 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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); diff --git a/src/protos.h b/src/protos.h index 7f4f2ffdab..f42f4b58e1 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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); diff --git a/src/stat.cc b/src/stat.cc index dcb7694d14..5e9ef651ec 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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) { diff --git a/src/structs.h b/src/structs.h index 7e23782033..80f89433de 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;