storeAppendPrintf(e, "\nField type distribution\n");
storeAppendPrintf(e, "%2s\t %-20s\t %5s\t %6s\n",
"id", "name", "count", "#/header");
- statHistDump(&hs->fieldTypeDistr, e, httpHeaderFieldStatDumper);
+ hs->fieldTypeDistr.dump(e, httpHeaderFieldStatDumper);
storeAppendPrintf(e, "\nCache-control directives distribution\n");
storeAppendPrintf(e, "%2s\t %-20s\t %5s\t %6s\n",
"id", "name", "count", "#/cc_field");
- statHistDump(&hs->ccTypeDistr, e, httpHdrCcStatDumper);
+ hs->ccTypeDistr.dump(e, httpHdrCcStatDumper);
storeAppendPrintf(e, "\nSurrogate-control directives distribution\n");
storeAppendPrintf(e, "%2s\t %-20s\t %5s\t %6s\n",
"id", "name", "count", "#/sc_field");
- statHistDump(&hs->scTypeDistr, e, httpHdrScStatDumper);
+ hs->scTypeDistr.dump(e, httpHdrScStatDumper);
storeAppendPrintf(e, "\nNumber of fields per header distribution\n");
storeAppendPrintf(e, "%2s\t %-5s\t %5s\t %6s\n",
"id", "#flds", "count", "%total");
- statHistDump(&hs->hdrUCountDistr, e, httpHeaderFldsPerHdrDumper);
+ hs->hdrUCountDistr.dump(e, httpHeaderFldsPerHdrDumper);
dump_stat = NULL;
}
}
void
-statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd)
+StatHist::dump(StoreEntry * sentry, StatHistBinDumper * bd) const
{
int i;
- double left_border = H->min;
+ double left_border = min;
if (!bd)
bd = statHistBinDumper;
- for (i = 0; i < H->capacity; i++) {
- const double right_border = H->val(i + 1);
+ for (i = 0; i < capacity; ++i) {
+ const double right_border = val(i + 1);
assert(right_border - left_border > 0.0);
- bd(sentry, i, left_border, right_border - left_border, H->bins[i]);
+ bd(sentry, i, left_border, right_border - left_border, bins[i]);
left_border = right_border;
}
}
StatHist() : bins(NULL), capacity(0), min(0), max(0), scale(1.0),
val_in(NULL), val_out(NULL) {};
StatHist(const StatHist&);
- void dump(StoreEntry *sentry, StatHistBinDumper * bd);
+ 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 statHistCount(StatHist * H, double val);
double statHistDeltaMedian(const StatHist & A, const StatHist & B);
double statHistDeltaPctile(const StatHist & A, const StatHist & B, double pctile);
-void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd);
void statHistLogInit(StatHist * H, int capacity, double min, double max);
void statHistEnumInit(StatHist * H, int last_enum);
void statHistIntInit(StatHist * H, int n);
StatCounters *f = &statCounter;
storeAppendPrintf(sentry, "Total number of epoll(2) loops: %ld\n", statCounter.select_loops);
storeAppendPrintf(sentry, "Histogram of returned filedescriptors\n");
- statHistDump(&f->select_fds_hist, sentry, statHistIntDumper);
+ f->select_fds_hist.dump(sentry, statHistIntDumper);
}
/**
static void
statCountersHistograms(StoreEntry * sentry)
{
- StatCounters *f = &statCounter;
storeAppendPrintf(sentry, "client_http.all_svc_time histogram:\n");
- statHistDump(&f->client_http.all_svc_time, sentry, NULL);
+ statCounter.client_http.all_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "client_http.miss_svc_time histogram:\n");
- statHistDump(&f->client_http.miss_svc_time, sentry, NULL);
+ statCounter.client_http.miss_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "client_http.nm_svc_time histogram:\n");
- statHistDump(&f->client_http.nm_svc_time, sentry, NULL);
+ statCounter.client_http.nm_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "client_http.nh_svc_time histogram:\n");
- statHistDump(&f->client_http.nh_svc_time, sentry, NULL);
+ statCounter.client_http.nh_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "client_http.hit_svc_time histogram:\n");
- statHistDump(&f->client_http.hit_svc_time, sentry, NULL);
+ statCounter.client_http.hit_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "icp.query_svc_time histogram:\n");
- statHistDump(&f->icp.query_svc_time, sentry, NULL);
+ statCounter.icp.query_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "icp.reply_svc_time histogram:\n");
- statHistDump(&f->icp.reply_svc_time, sentry, NULL);
+ statCounter.icp.reply_svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "dns.svc_time histogram:\n");
- statHistDump(&f->dns.svc_time, sentry, NULL);
+ statCounter.dns.svc_time.dump(sentry, NULL);
storeAppendPrintf(sentry, "select_fds_hist histogram:\n");
- statHistDump(&f->select_fds_hist, sentry, NULL);
+ statCounter.select_fds_hist.dump(sentry, NULL);
}
static void
{
//NO-OP fatal("statHistEnumInit: Not implemented");
}
+
+void
+StatHist::dump(StoreEntry * sentry, StatHistBinDumper * bd) const
+{
+ // noop
+}