From: wessels <> Date: Tue, 8 May 2007 00:38:40 +0000 (+0000) Subject: Author: Alex Rousskov cmdline->key); @@ -557,8 +562,11 @@ helperStats(StoreEntry * sentry, helper * hlp) } void -helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp) +helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label) { + if (!helperStartStats(sentry, hlp, label)) + return; + helper_stateful_server *srv; dlink_node *link; double tt; @@ -1592,3 +1600,19 @@ helperStatefulRequestFree(helper_stateful_request * r) xfree(r->buf); delete r; } + +// TODO: should helper_ and helper_stateful_ have a common parent? +static bool +helperStartStats(StoreEntry *sentry, void *hlp, const char *label) +{ + if (!hlp) { + if (label) + storeAppendPrintf(sentry, "%s: unavailable\n", label); + return false; + } + + if (label) + storeAppendPrintf(sentry, "%s:\n", label); + + return true; +} diff --git a/src/helper.h b/src/helper.h index 0d6fe303cb..67992019d0 100644 --- a/src/helper.h +++ b/src/helper.h @@ -1,6 +1,6 @@ /* - * $Id: helper.h,v 1.8 2006/09/03 19:12:52 serassio Exp $ + * $Id: helper.h,v 1.9 2007/05/07 18:38:40 wessels Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -238,8 +238,8 @@ SQUIDCEXTERN void helperOpenServers(helper * hlp); SQUIDCEXTERN void helperStatefulOpenServers(statefulhelper * hlp); SQUIDCEXTERN void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data); SQUIDCEXTERN void helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, void *data, helper_stateful_server * lastserver); -SQUIDCEXTERN void helperStats(StoreEntry * sentry, helper * hlp); -SQUIDCEXTERN void helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp); +SQUIDCEXTERN void helperStats(StoreEntry * sentry, helper * hlp, const char *label = NULL); +SQUIDCEXTERN void helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label = NULL); SQUIDCEXTERN void helperShutdown(helper * hlp); SQUIDCEXTERN void helperStatefulShutdown(statefulhelper * hlp); SQUIDCEXTERN helper *helperCreate(const char *); diff --git a/src/redirect.cc b/src/redirect.cc index eaa351b1ad..7cbf66314b 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.117 2007/04/28 22:26:37 hno Exp $ + * $Id: redirect.cc,v 1.118 2007/05/07 18:38:40 wessels Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -101,8 +101,7 @@ redirectStats(StoreEntry * sentry) return; } - storeAppendPrintf(sentry, "Redirector Statistics:\n"); - helperStats(sentry, redirectors); + helperStats(sentry, redirectors, "Redirector Statistics"); if (Config.onoff.redirector_bypass) storeAppendPrintf(sentry, "\nNumber of requests bypassed "