From cc66fb85e3b1cf69466b8ad8d578c9d48f868c1f Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Tue, 16 Sep 2014 16:18:02 +0000 Subject: [PATCH] Track how much we miss the idle notification limit We can't report negative values using histograms, so we split the data up into two histograms BUG=chromium:397026 LOG=n R=hpayer@chromium.org Review URL: https://codereview.chromium.org/572293002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23981 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/counters.h | 8 +++++--- src/heap/heap.cc | 15 +++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/counters.h b/src/counters.h index ed9f8a8..1aeb943 100644 --- a/src/counters.h +++ b/src/counters.h @@ -291,9 +291,11 @@ 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_RANGE_LIST(HR) \ + /* Generic range histograms */ \ + HR(gc_idle_time_allotted_in_ms, V8.GCIdleTimeAllottedInMS, 0, 10000, 101) \ + HR(gc_idle_time_limit_overshot, V8.GCIdleTimeLimit.Overshot, 0, 10000, 101) \ + HR(gc_idle_time_limit_undershot, V8.GCIdleTimeLimi.Undershot, 0, 10000, 101) #define HISTOGRAM_TIMER_LIST(HT) \ /* Garbage collection timers. */ \ diff --git a/src/heap/heap.cc b/src/heap/heap.cc index c96ea97..97445a6 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -4290,9 +4290,7 @@ bool Heap::IdleNotification(int idle_time_in_ms) { // If incremental marking is off, we do not perform idle notification. if (!FLAG_incremental_marking) return true; base::ElapsedTimer timer; - if (FLAG_trace_idle_notification) { - timer.Start(); - } + timer.Start(); isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( idle_time_in_ms); HistogramTimerScope idle_notification_scope( @@ -4348,8 +4346,17 @@ bool Heap::IdleNotification(int idle_time_in_ms) { case DO_NOTHING: break; } + + int actual_time_ms = static_cast(timer.Elapsed().InMilliseconds()); + if (actual_time_ms <= idle_time_in_ms) { + isolate()->counters()->gc_idle_time_limit_undershot()->AddSample( + idle_time_in_ms - actual_time_ms); + } else { + isolate()->counters()->gc_idle_time_limit_overshot()->AddSample( + actual_time_ms - idle_time_in_ms); + } + if (FLAG_trace_idle_notification) { - int actual_time_ms = static_cast(timer.Elapsed().InMilliseconds()); PrintF("Idle notification: requested idle time %d ms, actual time %d ms [", idle_time_in_ms, actual_time_ms); action.Print(); -- 2.7.4