--------------------- PatchSet 10359 Date: 2008/01/03 15:50:17 Author: adri Branch: s27_adri Tag: (none) Log: Fix buf_t statistics; generating the cachemgr pages now uses buf_t's; so displayign the active ones requires more thought. Members: libbuf/buf.c:1.1.2.9->1.1.2.10 src/mem.c:1.31.8.2->1.31.8.3 Index: squid/libbuf/buf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/libbuf/Attic/buf.c,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -r1.1.2.9 -r1.1.2.10 --- squid/libbuf/buf.c 28 Dec 2007 07:50:24 -0000 1.1.2.9 +++ squid/libbuf/buf.c 3 Jan 2008 15:50:18 -0000 1.1.2.10 @@ -17,6 +17,7 @@ static MemPool *buf_pool = NULL; dlink_list buf_active_list; +int buf_active_num = 0; void buf_init(void) @@ -81,6 +82,7 @@ if (! b) return NULL; dlinkAddTail(b, &b->node, &buf_active_list); + buf_active_num++; debug (85, 5) ("buf_create: %p\n", b); buf_ref(b); b->create.file = file; @@ -114,6 +116,7 @@ return NULL; bzero(b, sizeof(*b)); dlinkAddTail(b, &b->node, &buf_active_list); + buf_active_num++; debug(85, 5) ("buf_create: %p\n", b); b->b = (char *)data; b->len = b->size = b->sofs = len; @@ -159,6 +162,7 @@ free(b->b); b->b = NULL; } dlinkDelete(&b->node, &buf_active_list); + buf_active_num--; memPoolFree(buf_pool, b); return NULL; } Index: squid/src/mem.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mem.c,v retrieving revision 1.31.8.2 retrieving revision 1.31.8.3 diff -u -r1.31.8.2 -r1.31.8.3 --- squid/src/mem.c 28 Dec 2007 07:50:51 -0000 1.31.8.2 +++ squid/src/mem.c 3 Jan 2008 15:50:17 -0000 1.31.8.3 @@ -1,6 +1,6 @@ /* - * $Id: mem.c,v 1.31.8.2 2007/12/28 07:50:51 adri Exp $ + * $Id: mem.c,v 1.31.8.3 2008/01/03 15:50:17 adri Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -113,15 +113,21 @@ memBufTStats(StoreEntry *sentry) { dlink_node *n; - buf_t *b; + buf_t *b, *last = NULL; + /* The list will be appended to whilst we spit this out; hence the magic */ n = buf_active_list.head; - while (n != NULL) { + if (buf_active_list.tail) { + last = buf_ref(buf_active_list.tail->data); + } + + while (n != NULL && n->data != last) { b = n->data; n = n->next; storeAppendPrintf(sentry, "buf: %p: created %s:%d\n", b, b->create.file, b->create.line); } - + if (last) + last = buf_deref(last); }