Chromium Code Reviews| Index: src/counters.h |
| diff --git a/src/counters.h b/src/counters.h |
| index e5e60fe5ade50727f92065a155a590fecfd57d00..937b1d320d12b18aa33fb8dc348ecae1b242ef9c 100644 |
| --- a/src/counters.h |
| +++ b/src/counters.h |
| @@ -228,6 +228,21 @@ class Histogram { |
| Isolate* isolate_; |
| }; |
| +// A histogram base on megabytes. Use method add() to add a value to |
| +// the table. |
| +class MegabyteHistogram : public Histogram { |
| + public: |
| + MegabyteHistogram() {} |
| + MegabyteHistogram(const char* name, int min, int max, int num_buckets, |
| + Isolate* isolate) |
| + : Histogram(name, min, max, num_buckets, isolate) {} |
| + |
| + void Add(size_t size) { |
| + constexpr size_t kBitsInMegabyte = 20; |
| + AddSample(static_cast<int>(size >> kBitsInMegabyte)); |
| + } |
| +}; |
|
bbudge
2017/04/03 18:02:41
This seems like a lot just to scale the sizes, and
kschimpf
2017/04/03 19:20:55
After considerable discussion, we decided to move
|
| + |
| // A HistogramTimer allows distributions of results to be created. |
| class HistogramTimer : public Histogram { |
| public: |
| @@ -928,9 +943,11 @@ class RuntimeCallTimerScope { |
| HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 100000, \ |
| 51) \ |
| HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1, \ |
| - 100000, 51) \ |
| - HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 1, 32, 32) \ |
| - HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 1, 32, 32) |
| + 100000, 51) |
| + |
| +#define MEGABYTE_HISTOGRAM_RANGE_LIST(HR) \ |
| + HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 0, 4096, 13) \ |
| + HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 0, 4096, 13) |
| #define HISTOGRAM_TIMER_LIST(HT) \ |
| /* Garbage collection timers. */ \ |
| @@ -1168,6 +1185,11 @@ class Counters { |
| HISTOGRAM_RANGE_LIST(HR) |
| #undef HR |
| +#define HR(name, caption, min, max, num_buckets) \ |
| + MegabyteHistogram* name() { return &name##_; } |
| + MEGABYTE_HISTOGRAM_RANGE_LIST(HR) |
| +#undef HR |
| + |
| #define HT(name, caption, max, res) \ |
| HistogramTimer* name() { return &name##_; } |
| HISTOGRAM_TIMER_LIST(HT) |
| @@ -1277,6 +1299,10 @@ class Counters { |
| HISTOGRAM_RANGE_LIST(HR) |
| #undef HR |
| +#define HR(name, caption, min, max, num_buckets) MegabyteHistogram name##_; |
| + MEGABYTE_HISTOGRAM_RANGE_LIST(HR) |
| +#undef HR |
| + |
| #define HT(name, caption, max, res) HistogramTimer name##_; |
| HISTOGRAM_TIMER_LIST(HT) |
| #undef HT |