From: wessels <> Date: Thu, 23 Jul 1998 03:24:41 +0000 (+0000) Subject: Added 5min CPU usage and total memory account to cachemgr info page X-Git-Tag: SQUID_3_0_PRE1~3010 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=979533fa384003c6f000b73a3e9966622ee012ad;p=thirdparty%2Fsquid.git Added 5min CPU usage and total memory account to cachemgr info page --- diff --git a/src/protos.h b/src/protos.h index f1d5803043..9a143f366e 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.239 1998/07/22 21:08:11 wessels Exp $ + * $Id: protos.h,v 1.240 1998/07/22 21:24:41 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -662,6 +662,8 @@ extern void statInit(void); extern double median_svc_get(int, int); extern void pconnHistCount(int, int); extern int stat5minClientRequests(void); +extern double stat5minCPUUsage(void); + /* StatHist */ diff --git a/src/stat.cc b/src/stat.cc index 7d3670b48a..1f7125162a 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.265 1998/07/22 21:07:37 wessels Exp $ + * $Id: stat.cc,v 1.266 1998/07/22 21:24:42 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -499,6 +499,8 @@ info_get(StoreEntry * sentry) storeAppendPrintf(sentry, "\tCPU Time:\t%.3f seconds\n", cputime); storeAppendPrintf(sentry, "\tCPU Usage:\t%.2f%%\n", dpercent(cputime, runtime)); + storeAppendPrintf(sentry, "\tCPU Usage, 5 minute avg:\t%.2f%%\n", + stat5minCPUUsage()); storeAppendPrintf(sentry, "\tMaximum Resident Size: %d KB\n", rusage_maxrss(&rusage)); storeAppendPrintf(sentry, "\tPage faults with physical i/o: %d\n", @@ -548,8 +550,8 @@ info_get(StoreEntry * sentry) #endif /* HAVE_EXT_MALLINFO */ #endif /* HAVE_MALLINFO */ storeAppendPrintf(sentry, "Memory accounted for:\n"); - storeAppendPrintf(sentry, "\tTotal accounted: %6d KB %d%%\n", - memTotalAllocated()); + storeAppendPrintf(sentry, "\tTotal accounted: %6d KB\n", + memTotalAllocated()>>10); storeAppendPrintf(sentry, "File descriptor usage for %s:\n", appname); storeAppendPrintf(sentry, "\tMaximum number of file descriptors: %4d\n", @@ -733,6 +735,7 @@ statAvgDump(StoreEntry * sentry, int minutes, int hours) storeAppendPrintf(sentry, "cpu_usage = %f%%\n", dpercent(ct, dt)); } + void statInit(void) { @@ -1175,6 +1178,12 @@ stat5minClientRequests(void) return Counter.client_http.requests - CountHist[5].client_http.requests; } +double +stat5minCPUUsage(void) +{ + return dpercent(CountHist[0].cputime - CountHist[5].cputime, + tvSubDsec(CountHist[5].timestamp, CountHist[0].timestamp)); +} #if STAT_GRAPHS /*