From: Francesco Chemolli Date: Mon, 12 Dec 2011 16:46:49 +0000 (+0100) Subject: Refactored statHistIntInit X-Git-Tag: BumpSslServerFirst.take05~12^2~120^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e161cb088036c4637e106939e93af3c0ffca548e;p=thirdparty%2Fsquid.git Refactored statHistIntInit --- diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 9d039ba37a..5e59aa4ec3 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -372,10 +372,10 @@ httpHeaderStatInit(HttpHeaderStat * hs, const char *label) assert(label); memset(hs, 0, sizeof(HttpHeaderStat)); hs->label = label; - statHistEnumInit(&hs->hdrUCountDistr, 32); /* not a real enum */ - statHistEnumInit(&hs->fieldTypeDistr, HDR_ENUM_END); - statHistEnumInit(&hs->ccTypeDistr, CC_ENUM_END); - statHistEnumInit(&hs->scTypeDistr, SC_ENUM_END); + hs->hdrUCountDistr.enumInit(32); /* not a real enum */ + hs->fieldTypeDistr.enumInit(HDR_ENUM_END); + hs->ccTypeDistr.enumInit(CC_ENUM_END); + hs->scTypeDistr.enumInit(SC_ENUM_END); } /* diff --git a/src/Makefile.am b/src/Makefile.am index 0671627f97..67766eabfe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1087,6 +1087,7 @@ tests_testHttpReply_SOURCES=\ StatCounters.h \ StatCounters.cc \ StatHist.h \ + StatHist.cc \ tests/stub_StatHist.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ diff --git a/src/StatHist.cc b/src/StatHist.cc index d1936eaea1..7dd385e8cb 100644 --- a/src/StatHist.cc +++ b/src/StatHist.cc @@ -274,13 +274,6 @@ StatHist::enumInit(int last_enum) init(last_enum + 3, Math::Null, Math::Null, (double) -1, (double) (last_enum + 1 + 1)); } -void -statHistEnumInit(StatHist * H, int last_enum) -{ - H->enumInit(last_enum); -} - - void statHistEnumDumper(StoreEntry * sentry, int idx, double val, double size, int count) { @@ -289,12 +282,6 @@ statHistEnumDumper(StoreEntry * sentry, int idx, double val, double size, int co idx, (int) val, count); } -void -statHistIntInit(StatHist * H, int n) -{ - H->init(n, Math::Null, Math::Null, (double) 0, (double) n - 1); -} - void statHistIntDumper(StoreEntry * sentry, int idx, double val, double size, int count) { diff --git a/src/StatHist.h b/src/StatHist.h index dde020ab21..3ff4bfd926 100644 --- a/src/StatHist.h +++ b/src/StatHist.h @@ -31,7 +31,6 @@ #ifndef STATHIST_H_ #define STATHIST_H_ -#include "config.h" #include "typedefs.h" /* @@ -68,8 +67,7 @@ protected: void statHistCount(StatHist * H, double val); double statHistDeltaMedian(const StatHist & A, const StatHist & B); double statHistDeltaPctile(const StatHist & A, const StatHist & B, double pctile); -void statHistEnumInit(StatHist * H, int last_enum); -void statHistIntInit(StatHist * H, int n); +//void statHistIntInit(StatHist * H, int n); StatHistBinDumper statHistEnumDumper; StatHistBinDumper statHistIntDumper; diff --git a/src/stat.cc b/src/stat.cc index 22320f829c..1291b20740 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1503,11 +1503,11 @@ statCountersInitSpecial(StatCounters * C) /* * Cache Digest Stuff */ - statHistEnumInit(&C->cd.on_xition_count, CacheDigestHashFuncCount); - statHistEnumInit(&C->comm_icp_incoming, INCOMING_ICP_MAX); - statHistEnumInit(&C->comm_dns_incoming, INCOMING_DNS_MAX); - statHistEnumInit(&C->comm_http_incoming, INCOMING_HTTP_MAX); - statHistIntInit(&C->select_fds_hist, 256); /* was SQUID_MAXFD, but it is way too much. It is OK to crop this statistics */ + C->cd.on_xition_count.enumInit(CacheDigestHashFuncCount); + C->comm_icp_incoming.enumInit(INCOMING_ICP_MAX); + C->comm_dns_incoming.enumInit(INCOMING_DNS_MAX); + C->comm_http_incoming.enumInit(INCOMING_HTTP_MAX); + C->select_fds_hist.enumInit(256); /* was SQUID_MAXFD, but it is way too much. It is OK to crop this statistics */ } /* add special cases here as they arrive */ diff --git a/src/tests/stub_StatHist.cc b/src/tests/stub_StatHist.cc index 2c3caab146..07f1b4cd3c 100644 --- a/src/tests/stub_StatHist.cc +++ b/src/tests/stub_StatHist.cc @@ -3,20 +3,8 @@ // for StatHist definitions #include "StatHist.h" -void -StatHist::count(double val) -{ - fatal("statHistCount: Not implemented"); -} - void statHistEnumInit(StatHist * H, int last_enum) { //NO-OP fatal("statHistEnumInit: Not implemented"); } - -void -StatHist::dump(StoreEntry * sentry, StatHistBinDumper * bd) const -{ - // noop -}