small add to xmall-stats that saves off current stats array and
shows delta-counts of each size-allocations since last refresh of
cachemgr page.
Allows to better monitor what sizes of allocation get most hits.
Index: util.c
===================================================================
RCS file: /cvsroot/squid/squid/lib/util.c,v
retrieving revision 1.1.1.3.4.1.4.1
diff -u -r1.1.1.3.4.1.4.1 util.c
--- util.c 2000/08/01 00:48:07 1.1.1.3.4.1.4.1
+++ util.c 2000/10/05 18:04:57
@@ -108,6 +109,7 @@
#define DBG_MAXINDEX (DBG_MAXSIZE/DBG_GRAIN)
#define DBG_INDEX(sz) (sz<DBG_MAXSIZE?(sz+DBG_GRAIN-1)/DBG_GRAIN:DBG_MAXINDEX)
static int malloc_sizes[DBG_MAXINDEX + 1];
+static int malloc_histo[DBG_MAXINDEX + 1];
static int dbg_stat_init = 0;
@@ -116,7 +118,7 @@
{
int i;
for (i = 0; i <= DBG_MAXINDEX; i++)
- malloc_sizes[i] = 0;
+ malloc_sizes[i] = malloc_histo[i] = 0;
dbg_stat_init = 1;
}
@@ -129,11 +131,12 @@
}
void
-malloc_statistics(void (*func) (int, int, void *), void *data)
+malloc_statistics(void (*func) (int, int, int, void *), void *data)
{
int i;
for (i = 0; i <= DBG_MAXSIZE; i += DBG_GRAIN)
- func(i, malloc_sizes[DBG_INDEX(i)], data);
+ func(i, malloc_sizes[DBG_INDEX(i)], malloc_histo[DBG_INDEX(i)], data);
+ xmemcpy(&malloc_histo, &malloc_sizes, sizeof(malloc_sizes));
}
#endif /* XMALLOC_STATISTICS */
Index: util.h
===================================================================
RCS file: /cvsroot/squid/squid/include/util.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 util.h
--- util.h 2000/01/26 03:25:00 1.1.1.3
+++ util.h 2000/10/05 18:05:35
@@ -85,7 +85,7 @@
extern void rfc1738_unescape(char *);
#if XMALLOC_STATISTICS
-extern void malloc_statistics(void (*)(int, int, void *), void *);
+extern void malloc_statistics(void (*)(int, int, int, void *), void *);
#endif
#if XMALLOC_TRACE
Index: stat.c
===================================================================
RCS file: /cvsroot/squid/squid/src/stat.c,v
retrieving revision 1.1.1.3.4.1
diff -u -r1.1.1.3.4.1 stat.c
--- stat.c 2000/04/17 00:56:53 1.1.1.3.4.1
+++ stat.c 2000/10/05 18:05:46
@@ -79,7 +79,7 @@
static OBJH statClientRequests;
#ifdef XMALLOC_STATISTICS
-static void info_get_mallstat(int, int, void *);
+static void info_get_mallstat(int, int, int, void *);
#endif
StatCounters CountHist[N_COUNT_HIST];
@@ -383,11 +383,11 @@
#ifdef XMALLOC_STATISTICS
static void
-info_get_mallstat(int size, int number, void *data)
+info_get_mallstat(int size, int number, int oldnum, void *data)
{
StoreEntry *sentry = data;
if (number > 0)
- storeAppendPrintf(sentry, "\t%d = %d\n", size, number);
+ storeAppendPrintf(sentry, "%d\t %d\t %d \n", size, number, number - oldnum );
}
#endif
@@ -616,7 +616,8 @@
n_disk_objects);
#if XMALLOC_STATISTICS
- storeAppendPrintf(sentry, "Memory allocation statistics\n");
+ storeAppendPrintf(sentry, "\nMemory allocation statistics\n");
+ storeAppendPrintf(sentry, "Allocation Size\t Alloc Count\t Alloc Delta \n");
malloc_statistics(info_get_mallstat, sentry);
#endif
}
------- End of forwarded message -------
------------------------------------
Andres Kroonmaa <andre@online.ee>
Delfi Online
Tel: 6501 731, Fax: 6501 708
Pärnu mnt. 158, Tallinn,
11317 Estonia
Received on Thu Oct 05 2000 - 12:29:39 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:41 MST