Revision: 23559
Author:   [email protected]
Date:     Mon Sep  1 12:06:16 2014 UTC
Log:      Trace idle notification.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/521873006
https://code.google.com/p/v8/source/detail?r=23559

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/heap/gc-idle-time-handler.cc
 /branches/bleeding_edge/src/heap/gc-idle-time-handler.h
 /branches/bleeding_edge/src/heap/heap.cc

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Mon Aug 25 13:07:09 2014 UTC +++ /branches/bleeding_edge/src/flag-definitions.h Mon Sep 1 12:06:16 2014 UTC
@@ -495,6 +495,8 @@
             "after each garbage collection")
 DEFINE_BOOL(trace_gc_ignore_scavenger, false,
             "do not print trace line after scavenger collection")
+DEFINE_BOOL(trace_idle_notification, false,
+            "print one trace line following each idle notification")
 DEFINE_BOOL(print_cumulative_gc_stat, false,
             "print cumulative GC statistics in name=value format on exit")
 DEFINE_BOOL(print_max_heap_committed, false,
=======================================
--- /branches/bleeding_edge/src/heap/gc-idle-time-handler.cc Fri Aug 22 13:26:29 2014 UTC +++ /branches/bleeding_edge/src/heap/gc-idle-time-handler.cc Mon Sep 1 12:06:16 2014 UTC
@@ -16,6 +16,27 @@
 const int GCIdleTimeHandler::kIdleScavengeThreshold = 5;


+void GCIdleTimeAction::Print() {
+  switch (type) {
+    case DO_NOTHING:
+      PrintF("no action");
+      break;
+    case DO_INCREMENTAL_MARKING:
+ PrintF("incremental marking with step %" V8_PTR_PREFIX "d", parameter);
+      break;
+    case DO_SCAVENGE:
+      PrintF("scavenge");
+      break;
+    case DO_FULL_GC:
+      PrintF("full GC");
+      break;
+    case DO_FINALIZE_SWEEPING:
+      PrintF("finalize sweeping");
+      break;
+  }
+}
+
+
 size_t GCIdleTimeHandler::EstimateMarkingStepSize(
     size_t idle_time_in_ms, size_t marking_speed_in_bytes_per_ms) {
   DCHECK(idle_time_in_ms > 0);
=======================================
--- /branches/bleeding_edge/src/heap/gc-idle-time-handler.h Fri Aug 22 13:26:29 2014 UTC +++ /branches/bleeding_edge/src/heap/gc-idle-time-handler.h Mon Sep 1 12:06:16 2014 UTC
@@ -55,6 +55,8 @@
     result.parameter = 0;
     return result;
   }
+
+  void Print();

   GCIdleTimeActionType type;
   intptr_t parameter;
=======================================
--- /branches/bleeding_edge/src/heap/heap.cc    Tue Aug 26 09:19:24 2014 UTC
+++ /branches/bleeding_edge/src/heap/heap.cc    Mon Sep  1 12:06:16 2014 UTC
@@ -4287,6 +4287,10 @@
 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();
+  }
   isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(
       idle_time_in_ms);
   HistogramTimerScope idle_notification_scope(
@@ -4336,6 +4340,13 @@
       result = true;
       break;
   }
+  if (FLAG_trace_idle_notification) {
+ int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); + PrintF("Idle notification: requested idle time %d ms, actual time %d ms [",
+           idle_time_in_ms, actual_time_ms);
+    action.Print();
+    PrintF("]\n");
+  }

   return result;
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to