Index: src/counters.cc |
diff --git a/src/counters.cc b/src/counters.cc |
index 996aa333d411fe08526f1f80bc00a351dabae21d..87ab983bd94f12d4ab9de32a27c84382623cada4 100644 |
--- a/src/counters.cc |
+++ b/src/counters.cc |
@@ -81,6 +81,24 @@ Counters::Counters(Isolate* isolate) { |
} |
static const struct { |
+ MegabyteHistogram Counters::*member; |
+ const char* caption; |
Mircea Trofin
2017/04/03 17:26:20
could we initialize the members in-place? (caption
kschimpf
2017/04/03 17:33:41
Explicit initialization is done in the entries usi
|
+ int min; |
+ int max; |
+ int num_buckets; |
+ } kMegabyteHistograms[] = { |
+#define HR(name, caption, min, max, num_buckets) \ |
+ {&Counters::name##_, #caption, min, max, num_buckets}, |
+ MEGABYTE_HISTOGRAM_RANGE_LIST(HR) |
+#undef HR |
+ }; |
+ for (const auto& histogram : kMegabyteHistograms) { |
+ this->*histogram.member = |
+ MegabyteHistogram(histogram.caption, histogram.min, histogram.max, |
+ histogram.num_buckets, isolate); |
+ } |
+ |
+ static const struct { |
HistogramTimer Counters::*member; |
const char* caption; |
int max; |
@@ -238,6 +256,10 @@ void Counters::ResetHistograms() { |
HISTOGRAM_RANGE_LIST(HR) |
#undef HR |
+#define HR(name, caption, min, max, num_buckets) name##_.Reset(); |
+ MEGABYTE_HISTOGRAM_RANGE_LIST(HR) |
+#undef HR |
+ |
#define HT(name, caption, max, res) name##_.Reset(); |
HISTOGRAM_TIMER_LIST(HT) |
#undef HT |