From 97d30a2e30064c2f1cd38205a9e28902a245c724 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Sat, 10 Dec 2011 23:02:17 +0100 Subject: [PATCH] StatHist data members are now protected, not private. ported some clients from statHistLogInit to StatHist::logInit --- src/StatHist.cc | 8 +++++++- src/StatHist.h | 5 +---- src/stat.cc | 16 ++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/StatHist.cc b/src/StatHist.cc index 2ec43bcf54..23b0846ebc 100644 --- a/src/StatHist.cc +++ b/src/StatHist.cc @@ -254,10 +254,16 @@ Math::Exp(double x) return exp(x) - 1.0; } +void +StatHist::logInit(int capacity, double min, double max) +{ + init(capacity, Math::Log, Math::Exp, min, max); +} + void statHistLogInit(StatHist * H, int capacity, double min, double max) { - H->init(capacity, Math::Log, Math::Exp, min, max); + H->logInit(capacity, min, max); } /* linear histogram for enums */ diff --git a/src/StatHist.h b/src/StatHist.h index 77c5738076..7438030b2c 100644 --- a/src/StatHist.h +++ b/src/StatHist.h @@ -54,7 +54,7 @@ public: void intInit(int n); void init(int capacity, hbase_f * val_in, hbase_f * val_out, double min, double max); double deltaPctile(const StatHist & B, double pctile); -private: +protected: int findBin(double v); int *bins; int capacity; @@ -75,7 +75,4 @@ void statHistIntInit(StatHist * H, int n); StatHistBinDumper statHistEnumDumper; StatHistBinDumper statHistIntDumper; - - - #endif /* STATHIST_H_ */ diff --git a/src/stat.cc b/src/stat.cc index 0f0b4d7463..22320f829c 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); + C->client_http.all_svc_time.logInit(300, 0.0, 3600000.0 * 3.0); + C->client_http.miss_svc_time.logInit(300, 0.0, 3600000.0 * 3.0); + C->client_http.nm_svc_time.logInit(300, 0.0, 3600000.0 * 3.0); + C->client_http.nh_svc_time.logInit(300, 0.0, 3600000.0 * 3.0); + C->client_http.hit_svc_time.logInit(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); + C->icp.query_svc_time.logInit(300, 0.0, 1000000.0 * 60.0); + C->icp.reply_svc_time.logInit(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); + C->dns.svc_time.logInit(300, 0.0, 60000.0 * 10.0); /* * Cache Digest Stuff */ -- 2.47.3