Reviewers: Yang,

Message:
PTAL

Description:
Trace idle notification.

BUG=

Please review this at https://codereview.chromium.org/521873006/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+36, -0 lines):
  M src/flag-definitions.h
  M src/heap/gc-idle-time-handler.h
  M src/heap/gc-idle-time-handler.cc
  M src/heap/heap.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 7796700e14080ec80a5c8a9d80121de463b47087..87f83d9ae76974fc908b8e9562e191d6ba892fdb 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -495,6 +495,8 @@ DEFINE_BOOL(trace_gc_nvp, false,
             "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,
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc index 258d4fe00405ace8cdbc1142eb342d0f1209c63e..8def9005e647b344685050b96c19bac4fa1e3e98 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -16,6 +16,27 @@ const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7;
 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);
Index: src/heap/gc-idle-time-handler.h
diff --git a/src/heap/gc-idle-time-handler.h b/src/heap/gc-idle-time-handler.h index 7ffb7bd95a2be3261969987947086afd528705c1..b0bdce66143c818983b3849992a2efd01f2b9038 100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -56,6 +56,8 @@ class GCIdleTimeAction {
     return result;
   }

+  void Print();
+
   GCIdleTimeActionType type;
   intptr_t parameter;
 };
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index e31a281e5345163826988032f4029a28cd19f260..6781711defa7fdb90813f2109a3ac25a11cc67a8 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4287,6 +4287,10 @@ bool Heap::WorthActivatingIncrementalMarking() {
 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 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
       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