]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added 5min CPU usage and total memory account to cachemgr info page
authorwessels <>
Thu, 23 Jul 1998 03:24:41 +0000 (03:24 +0000)
committerwessels <>
Thu, 23 Jul 1998 03:24:41 +0000 (03:24 +0000)
src/protos.h
src/stat.cc

index f1d58030434e66b6d2365a4773e8f80beb093e16..9a143f366ef65a4574610c1858ddd77da95b52cf 100644 (file)
@@ -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 */
index 7d3670b48a37c7c736038470c2ff9efb00ccfd6a..1f7125162a47c06abf146b2e57806e7b75d539f5 100644 (file)
@@ -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
 /*