diff --git a/src/counters.cc b/src/counters.cc index 34e8467440..a8dcc0bdcb 100644 --- a/src/counters.cc +++ b/src/counters.cc @@ -55,6 +55,11 @@ void HistogramTimer::Stop() { Counters::Counters(Isolate* isolate) { +#define HR(name, caption, min, max, num_buckets) \ + name##_ = Histogram(#caption, min, max, num_buckets, isolate); + HISTOGRAM_RANGE_LIST(HR) +#undef HR + #define HT(name, caption) \ name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); HISTOGRAM_TIMER_LIST(HT) @@ -142,6 +147,10 @@ void Counters::ResetCounters() { void Counters::ResetHistograms() { +#define HR(name, caption, min, max, num_buckets) name##_.Reset(); + HISTOGRAM_RANGE_LIST(HR) +#undef HR + #define HT(name, caption) name##_.Reset(); HISTOGRAM_TIMER_LIST(HT) #undef HT diff --git a/src/counters.h b/src/counters.h index 895caf8e0f..ad30c0c5c6 100644 --- a/src/counters.h +++ b/src/counters.h @@ -291,6 +291,9 @@ class HistogramTimerScope BASE_EMBEDDED { #endif }; +#define HISTOGRAM_RANGE_LIST(HR) \ + /* Generic range histograms */ \ + HR(gc_idle_time_allotted_in_ms, V8.GCIdleTimeAllottedInMS, 0, 10000, 101) #define HISTOGRAM_TIMER_LIST(HT) \ /* Garbage collection timers. */ \ @@ -552,6 +555,11 @@ class HistogramTimerScope BASE_EMBEDDED { // This file contains all the v8 counters that are in use. class Counters { public: +#define HR(name, caption, min, max, num_buckets) \ + Histogram* name() { return &name##_; } + HISTOGRAM_RANGE_LIST(HR) +#undef HR + #define HT(name, caption) \ HistogramTimer* name() { return &name##_; } HISTOGRAM_TIMER_LIST(HT) @@ -639,6 +647,10 @@ class Counters { void ResetHistograms(); private: +#define HR(name, caption, min, max, num_buckets) Histogram name##_; + HISTOGRAM_RANGE_LIST(HR) +#undef HR + #define HT(name, caption) \ HistogramTimer name##_; HISTOGRAM_TIMER_LIST(HT) diff --git a/src/heap.cc b/src/heap.cc index 840301bbf5..36995336a4 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -54,8 +54,7 @@ Heap::Heap() isolate_(NULL), code_range_size_(0), // semispace_size_ should be a power of 2 and old_generation_size_ should - // be - // a multiple of Page::kPageSize. + // be a multiple of Page::kPageSize. reserved_semispace_size_(8 * (kPointerSize / 4) * MB), max_semi_space_size_(8 * (kPointerSize / 4) * MB), initial_semispace_size_(Page::kPageSize), @@ -4268,6 +4267,7 @@ bool Heap::IdleNotification(int hint) { intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; + isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(hint); HistogramTimerScope idle_notification_scope( isolate_->counters()->gc_idle_notification());