--------------------- PatchSet 11601 Date: 2007/08/31 13:46:25 Author: hno Branch: SQUID_2_6 Tag: (none) Log: MFC: Bug #1902: Adds Numeric Hit and invalid request counters to IP Cache Merged changes: 2007/08/17 05:06:15 amosjeffries +14 -5 Fix bug 1902 - Adds Numeric Hit and invalid request counters to IP Cache Members: src/ipcache.c:1.245->1.245.2.1 Index: squid/src/ipcache.c =================================================================== RCS file: /cvsroot/squid/squid/src/ipcache.c,v retrieving revision 1.245 retrieving revision 1.245.2.1 diff -u -r1.245 -r1.245.2.1 --- squid/src/ipcache.c 16 Aug 2006 00:27:20 -0000 1.245 +++ squid/src/ipcache.c 31 Aug 2007 13:46:25 -0000 1.245.2.1 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.c,v 1.245 2006/08/16 00:27:20 hno Exp $ + * $Id: ipcache.c,v 1.245.2.1 2007/08/31 13:46:25 hno Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -60,6 +60,8 @@ int hits; int misses; int negative_hits; + int numeric_hits; + int invalid; } IpcacheStats; static dlink_list lru_list; @@ -411,12 +413,14 @@ IpcacheStats.requests++; if (name == NULL || name[0] == '\0') { debug(14, 4) ("ipcache_nbgethostbyname: Invalid name!\n"); + IpcacheStats.invalid++; dns_error_message = "Invalid hostname"; handler(NULL, handlerData); return; } if ((addrs = ipcacheCheckNumeric(name))) { dns_error_message = NULL; + IpcacheStats.numeric_hits++; handler(addrs, handlerData); return; } @@ -514,6 +518,7 @@ } dns_error_message = NULL; if ((addrs = ipcacheCheckNumeric(name))) { + IpcacheStats.numeric_hits++; return addrs; } IpcacheStats.misses++; @@ -548,16 +553,20 @@ dlink_node *m; assert(ip_table != NULL); storeAppendPrintf(sentry, "IP Cache Statistics:\n"); - storeAppendPrintf(sentry, "IPcache Entries: %d\n", + storeAppendPrintf(sentry, "IPcache Entries: %d\n", memInUse(MEM_IPCACHE_ENTRY)); storeAppendPrintf(sentry, "IPcache Requests: %d\n", IpcacheStats.requests); - storeAppendPrintf(sentry, "IPcache Hits: %d\n", + storeAppendPrintf(sentry, "IPcache Hits: %d\n", IpcacheStats.hits); - storeAppendPrintf(sentry, "IPcache Negative Hits: %d\n", + storeAppendPrintf(sentry, "IPcache Negative Hits: %d\n", IpcacheStats.negative_hits); - storeAppendPrintf(sentry, "IPcache Misses: %d\n", + storeAppendPrintf(sentry, "IPcache Numeric Hits: %d\n", + IpcacheStats.numeric_hits); + storeAppendPrintf(sentry, "IPcache Misses: %d\n", IpcacheStats.misses); + storeAppendPrintf(sentry, "IPcache Invalid Requests: %d\n", + IpcacheStats.invalid); storeAppendPrintf(sentry, "\n\n"); storeAppendPrintf(sentry, "IP Cache Contents:\n\n"); storeAppendPrintf(sentry, " %-29.29s %3s %6s %6s %1s\n",