]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
date: 2003/01/10 17:52:53; author: wessels; state: Exp; lines: +1 -0
authorhno <>
Sat, 18 Jan 2003 09:10:37 +0000 (09:10 +0000)
committerhno <>
Sat, 18 Jan 2003 09:10:37 +0000 (09:10 +0000)
added reporting of "Process Data Segment Size via sbrk()" when
sbrk() call exists.  According to the sbrk() man page, calling
sbrk(0) returns the end of the data segment.  By storing the data
segment offset when Squid starts, we can report the size of the
data segment at any time.  This might be a better metric than
getrusage()'s MAX RSS, which, in my experience, is often less than
the process size reported by 'ps' (presumably because some of the
processes memory is swapped to disk).  However, initial tests show that
the sbrk() trick reports a value slightly smaller than reported by
'ps'.

date: 2003/01/17 05:21:49;  author: wessels;  state: Exp;  lines: +1 -1
failure_ratio is a ratio, not a percentage.  Removed %% from printf.

configure.in
include/autoconf.h.in
src/globals.h
src/main.cc
src/stat.cc

index b720c747a5a312807f92e3321cbd9f86e96c4dd3..5d3136b6a59bd96e6ae1a4903b3fb4ae07770946 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.311 2003/01/17 03:54:36 robertc Exp $
+dnl  $Id: configure.in,v 1.312 2003/01/18 02:10:37 hno Exp $
 dnl
 dnl
 dnl
@@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 3.0-DEVEL)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.311 $)dnl
+AC_REVISION($Revision: 1.312 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -1804,6 +1804,7 @@ AC_CHECK_FUNCS(\
        regfree \
        res_init \
        rint \
+       sbrk \
        select \
        seteuid \
        setgroups \
index de4d4b9f5ed5b795ddd88032f55f2af8059279b5..6e0c1d6fe394197d1667b61c4e3ced1797de7953 100644 (file)
 /* Define to 1 if you have the `rint' function. */
 #undef HAVE_RINT
 
+/* Define to 1 if you have the `sbrk' function. */
+#undef HAVE_SBRK
+
 /* Define to 1 if you have the <sched.h> header file. */
 #undef HAVE_SCHED_H
 
index 9b0467afc0a3d5e0fe8180e11940259c43a19f98..73f5b2cc98a51881e640beb504a22fff1c3d1316 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.116 2003/01/17 05:14:29 robertc Exp $
+ * $Id: globals.h,v 1.117 2003/01/18 02:10:40 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -159,6 +159,9 @@ extern int incoming_sockets_accepted;
 extern unsigned int WIN32_OS_version;  /* 0 */
 extern char *WIN32_OS_string;  /* NULL */
 #endif
+#if HAVE_SBRK
+extern void *sbrk_start;       /* 0 */
+#endif
 
 extern int ssl_ex_index_server;        /* -1 */
 extern int ssl_ctx_ex_index_dont_verify_domain; /* -1 */
index a8f1f1030e6ce9e69aeebcee9170a42c7c3c9de1..ff2ab97a54f12fc11a93a37e993f9e7f903b6bb2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.360 2003/01/02 08:44:17 robertc Exp $
+ * $Id: main.cc,v 1.361 2003/01/18 02:10:40 hno Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -568,6 +568,10 @@ main(int argc, char **argv)
     int WIN32_init_err;
 #endif
 
+#if HAVE_SBRK
+    sbrk_start = sbrk(0);
+#endif
+
     debug_log = stderr;
     if (FD_SETSIZE < Squid_MaxFD)
        Squid_MaxFD = FD_SETSIZE;
index 975113bb60065d57c254f95de9b8c03c9cec3099..797110cd00953ea1a9c9cf20529338f39468c43b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.364 2002/12/27 10:26:33 robertc Exp $
+ * $Id: stat.cc,v 1.365 2003/01/18 02:10:40 hno Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -457,7 +457,7 @@ info_get(StoreEntry * sentry)
        statCounter.icp.pkts_sent);
     storeAppendPrintf(sentry, "\tNumber of queued ICP replies:\t%u\n",
        statCounter.icp.replies_queued);
-    storeAppendPrintf(sentry, "\tRequest failure ratio:\t%5.2f%%\n",
+    storeAppendPrintf(sentry, "\tRequest failure ratio:\t%5.2f\n",
        request_failure_ratio);
 
     storeAppendPrintf(sentry, "\tAverage HTTP requests per minute since start:\t%.1f\n",
@@ -524,6 +524,10 @@ info_get(StoreEntry * sentry)
        statCPUUsage(5));
     storeAppendPrintf(sentry, "\tCPU Usage, 60 minute avg:\t%.2f%%\n",
        statCPUUsage(60));
+#if HAVE_SBRK
+    storeAppendPrintf(sentry, "\tProcess Data Segment Size via sbrk(): %d KB\n",
+       (sbrk(0) - sbrk_start) >> 10);
+#endif
     storeAppendPrintf(sentry, "\tMaximum Resident Size: %d KB\n",
        rusage_maxrss(&rusage));
     storeAppendPrintf(sentry, "\tPage faults with physical i/o: %d\n",