Index: src/counters.h |
diff --git a/src/counters.h b/src/counters.h |
index e5e60fe5ade50727f92065a155a590fecfd57d00..4a59e59c8f7473f0a0a94049c7916ce742b4f73d 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(size >> kBitsInMegabyte); |
+ } |
+}; |
+ |
// 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, 1, 4096, 13) \ |
+ HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 1, 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 |