From: amosjeffries <> Date: Fri, 17 Aug 2007 11:01:43 +0000 (+0000) Subject: Fix bug 1902 - Adds Numeric Hit and invalid request counters to IP Cache X-Git-Tag: SQUID_3_0_PRE7~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22b245f82296981d75f635cd193c32e79ebfd47c;p=thirdparty%2Fsquid.git Fix bug 1902 - Adds Numeric Hit and invalid request counters to IP Cache --- diff --git a/src/ipcache.cc b/src/ipcache.cc index f3d5dfc8cc..817de6c9ee 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.261 2007/05/29 13:31:40 amosjeffries Exp $ + * $Id: ipcache.cc,v 1.262 2007/08/17 05:01:43 amosjeffries Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -77,8 +77,9 @@ static struct int hits; int misses; int negative_hits; + int numeric_hits; + int invalid; } - IpcacheStats; static dlink_list lru_list; @@ -505,6 +506,7 @@ ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData) if (name == NULL || name[0] == '\0') { debugs(14, 4, "ipcache_nbgethostbyname: Invalid name!"); + IpcacheStats.invalid++; dns_error_message = "Invalid hostname"; handler(NULL, handlerData); return; @@ -512,6 +514,7 @@ ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData) if ((addrs = ipcacheCheckNumeric(name))) { dns_error_message = NULL; + IpcacheStats.numeric_hits++; handler(addrs, handlerData); return; } @@ -626,8 +629,10 @@ ipcache_gethostbyname(const char *name, int flags) dns_error_message = NULL; - if ((addrs = ipcacheCheckNumeric(name))) + if ((addrs = ipcacheCheckNumeric(name))) { + IpcacheStats.numeric_hits++; return addrs; + } IpcacheStats.misses++; @@ -665,16 +670,20 @@ stat_ipcache_get(StoreEntry * sentry) 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 Request: %d\n", + IpcacheStats.invalid); storeAppendPrintf(sentry, "\n\n"); storeAppendPrintf(sentry, "IP Cache Contents:\n\n"); storeAppendPrintf(sentry, " %-29.29s %3s %6s %6s %1s\n",