From: Francesco Chemolli Date: Wed, 7 Dec 2011 12:27:14 +0000 (+0100) Subject: NONWORKING: try subclassing instead of C-style pseudoconstructors. X-Git-Tag: BumpSslServerFirst.take05~12^2~120^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7edacc70eda6ae2f4ab552484a72eea747662dd;p=thirdparty%2Fsquid.git NONWORKING: try subclassing instead of C-style pseudoconstructors. --- diff --git a/src/StatHist.cc b/src/StatHist.cc index 85f28bd3dc..072f4db26a 100644 --- a/src/StatHist.cc +++ b/src/StatHist.cc @@ -288,3 +288,8 @@ statHistIntDumper(StoreEntry * sentry, int idx, double val, double size, int cou if (count) storeAppendPrintf(sentry, "%9d\t%9d\n", (int) val, count); } + +StatHistLog::StatHistLog(int capacity_, double min_, double max_) +{ + init(capacity_, Math::Log, Math::Exp, min_, max_); +} diff --git a/src/StatHist.h b/src/StatHist.h index e128b4a48e..ee3258116a 100644 --- a/src/StatHist.h +++ b/src/StatHist.h @@ -56,7 +56,6 @@ public: val_in(NULL), val_out(NULL) {}; StatHist(const StatHist&); void dump(StoreEntry *sentry, StatHistBinDumper * bd) const; - void logInit(int capacity, double min, double max); void enumInit(int last_enum); void intInit(int n); void init(int capacity, hbase_f * val_in, hbase_f * val_out, double min, double max); @@ -64,6 +63,14 @@ private: int findBin(double v); }; +class StatHistLog: public StatHist +{ + public: + StatHistLog(int capacity_, double min_, double max_); +}; + + + /* StatHist */ void statHistCount(StatHist * H, double val); double statHistDeltaMedian(const StatHist & A, const StatHist & B); diff --git a/src/stat.cc b/src/stat.cc index 033782e017..60dd5a1578 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1486,20 +1486,20 @@ statCountersInitSpecial(StatCounters * C) /* * HTTP svc_time hist is kept in milli-seconds; max of 3 hours. */ - statHistLogInit(&C->client_http.all_svc_time, 300, 0.0, 3600000.0 * 3.0); - statHistLogInit(&C->client_http.miss_svc_time, 300, 0.0, 3600000.0 * 3.0); - statHistLogInit(&C->client_http.nm_svc_time, 300, 0.0, 3600000.0 * 3.0); - statHistLogInit(&C->client_http.nh_svc_time, 300, 0.0, 3600000.0 * 3.0); - statHistLogInit(&C->client_http.hit_svc_time, 300, 0.0, 3600000.0 * 3.0); + //statHistLogInit(&C->client_http.all_svc_time, 300, 0.0, 3600000.0 * 3.0); + //statHistLogInit(&C->client_http.miss_svc_time, 300, 0.0, 3600000.0 * 3.0); + //statHistLogInit(&C->client_http.nm_svc_time, 300, 0.0, 3600000.0 * 3.0); + //statHistLogInit(&C->client_http.nh_svc_time, 300, 0.0, 3600000.0 * 3.0); + //statHistLogInit(&C->client_http.hit_svc_time, 300, 0.0, 3600000.0 * 3.0); /* * ICP svc_time hist is kept in micro-seconds; max of 1 minute. */ - statHistLogInit(&C->icp.query_svc_time, 300, 0.0, 1000000.0 * 60.0); - statHistLogInit(&C->icp.reply_svc_time, 300, 0.0, 1000000.0 * 60.0); +// statHistLogInit(&C->icp.query_svc_time, 300, 0.0, 1000000.0 * 60.0); +// statHistLogInit(&C->icp.reply_svc_time, 300, 0.0, 1000000.0 * 60.0); /* * DNS svc_time hist is kept in milli-seconds; max of 10 minutes. */ - statHistLogInit(&C->dns.svc_time, 300, 0.0, 60000.0 * 10.0); +// statHistLogInit(&C->dns.svc_time, 300, 0.0, 60000.0 * 10.0); /* * Cache Digest Stuff */ diff --git a/src/structs.h b/src/structs.h index d398e95485..5dd8ae1749 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1118,11 +1118,11 @@ struct _StatCounters { kb_t kbytes_in; kb_t kbytes_out; kb_t hit_kbytes_out; - StatHist miss_svc_time; - StatHist nm_svc_time; - StatHist nh_svc_time; - StatHist hit_svc_time; - StatHist all_svc_time; + StatHistLog miss_svc_time(300, 0.0, 3600000.0 * 3.0); + StatHistLog nm_svc_time(300, 0.0, 3600000.0 * 3.0); + StatHistLog nh_svc_time(300, 0.0, 3600000.0 * 3.0); + StatHistLog hit_svc_time(300, 0.0, 3600000.0 * 3.0); + StatHistLog all_svc_time(300, 0.0, 3600000.0 * 3.0); } client_http; struct { @@ -1152,8 +1152,8 @@ struct _StatCounters { kb_t kbytes_recv; kb_t q_kbytes_recv; kb_t r_kbytes_recv; - StatHist query_svc_time; - StatHist reply_svc_time; + StatHistLog query_svc_time(300, 0.0, 1000000.0 * 60.0); + StatHistLog reply_svc_time(300, 0.0, 1000000.0 * 60.0); int query_timeouts; int times_used; } icp; @@ -1168,7 +1168,7 @@ struct _StatCounters { } unlink; struct { - StatHist svc_time; + StatHistLog svc_time(300, 0.0, 60000.0 * 10.0); } dns; struct {