Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/counters.h" | 5 #include "src/counters.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/builtins/builtins-definitions.h" | 10 #include "src/builtins/builtins-definitions.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 HISTOGRAM_RANGE_LIST(HR) | 74 HISTOGRAM_RANGE_LIST(HR) |
| 75 #undef HR | 75 #undef HR |
| 76 }; | 76 }; |
| 77 for (const auto& histogram : kHistograms) { | 77 for (const auto& histogram : kHistograms) { |
| 78 this->*histogram.member = | 78 this->*histogram.member = |
| 79 Histogram(histogram.caption, histogram.min, histogram.max, | 79 Histogram(histogram.caption, histogram.min, histogram.max, |
| 80 histogram.num_buckets, isolate); | 80 histogram.num_buckets, isolate); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static const struct { | 83 static const struct { |
| 84 MegabyteHistogram Counters::*member; | |
| 85 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
| |
| 86 int min; | |
| 87 int max; | |
| 88 int num_buckets; | |
| 89 } kMegabyteHistograms[] = { | |
| 90 #define HR(name, caption, min, max, num_buckets) \ | |
| 91 {&Counters::name##_, #caption, min, max, num_buckets}, | |
| 92 MEGABYTE_HISTOGRAM_RANGE_LIST(HR) | |
| 93 #undef HR | |
| 94 }; | |
| 95 for (const auto& histogram : kMegabyteHistograms) { | |
| 96 this->*histogram.member = | |
| 97 MegabyteHistogram(histogram.caption, histogram.min, histogram.max, | |
| 98 histogram.num_buckets, isolate); | |
| 99 } | |
| 100 | |
| 101 static const struct { | |
| 84 HistogramTimer Counters::*member; | 102 HistogramTimer Counters::*member; |
| 85 const char* caption; | 103 const char* caption; |
| 86 int max; | 104 int max; |
| 87 HistogramTimer::Resolution res; | 105 HistogramTimer::Resolution res; |
| 88 } kHistogramTimers[] = { | 106 } kHistogramTimers[] = { |
| 89 #define HT(name, caption, max, res) \ | 107 #define HT(name, caption, max, res) \ |
| 90 {&Counters::name##_, #caption, max, HistogramTimer::res}, | 108 {&Counters::name##_, #caption, max, HistogramTimer::res}, |
| 91 HISTOGRAM_TIMER_LIST(HT) | 109 HISTOGRAM_TIMER_LIST(HT) |
| 92 #undef HT | 110 #undef HT |
| 93 }; | 111 }; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 CODE_AGE_LIST_COMPLETE(SC) | 249 CODE_AGE_LIST_COMPLETE(SC) |
| 232 #undef SC | 250 #undef SC |
| 233 } | 251 } |
| 234 | 252 |
| 235 | 253 |
| 236 void Counters::ResetHistograms() { | 254 void Counters::ResetHistograms() { |
| 237 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); | 255 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); |
| 238 HISTOGRAM_RANGE_LIST(HR) | 256 HISTOGRAM_RANGE_LIST(HR) |
| 239 #undef HR | 257 #undef HR |
| 240 | 258 |
| 259 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); | |
| 260 MEGABYTE_HISTOGRAM_RANGE_LIST(HR) | |
| 261 #undef HR | |
| 262 | |
| 241 #define HT(name, caption, max, res) name##_.Reset(); | 263 #define HT(name, caption, max, res) name##_.Reset(); |
| 242 HISTOGRAM_TIMER_LIST(HT) | 264 HISTOGRAM_TIMER_LIST(HT) |
| 243 #undef HT | 265 #undef HT |
| 244 | 266 |
| 245 #define AHT(name, caption) name##_.Reset(); | 267 #define AHT(name, caption) name##_.Reset(); |
| 246 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) | 268 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) |
| 247 #undef AHT | 269 #undef AHT |
| 248 | 270 |
| 249 #define HP(name, caption) name##_.Reset(); | 271 #define HP(name, caption) name##_.Reset(); |
| 250 HISTOGRAM_PERCENTAGE_LIST(HP) | 272 HISTOGRAM_PERCENTAGE_LIST(HP) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 RuntimeCallStats::counters) { | 511 RuntimeCallStats::counters) { |
| 490 RuntimeCallCounter* counter = &(this->*counter_id); | 512 RuntimeCallCounter* counter = &(this->*counter_id); |
| 491 if (counter->count() > 0) counter->Dump(value); | 513 if (counter->count() > 0) counter->Dump(value); |
| 492 } | 514 } |
| 493 | 515 |
| 494 in_use_ = false; | 516 in_use_ = false; |
| 495 } | 517 } |
| 496 | 518 |
| 497 } // namespace internal | 519 } // namespace internal |
| 498 } // namespace v8 | 520 } // namespace v8 |
| OLD | NEW |