Reviewers: jochen (slow),

Description:
Added --trace_idle_notification_verbose which prints out the idle notificatino
heap state.

BUG=

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+32, -2 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 49d44746e8297ed46c730cd50371a6a509985660..8c97d518e9beddf0ba9d0d53ccc8a66876dff936 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -541,6 +541,8 @@ 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(trace_idle_notification_verbose, false,
+            "prints the heap state used by the 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 accb87c99b6d455bb28b4a06047dbcfab6bfb1c0..beede4cdee3723c2d1be759fead90382c5f49304 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -41,6 +41,25 @@ void GCIdleTimeAction::Print() {
 }


+void GCIdleTimeHandler::HeapState::Print() {
+  PrintF("contexts_disposed=%d ", contexts_disposed);
+  PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate);
+  PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects);
+  PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped);
+ PrintF("can_start_incremental_marking=%d ", can_start_incremental_marking);
+  PrintF("sweeping_in_progress=%d ", sweeping_in_progress);
+  PrintF("mark_compact_speed=%" V8_PTR_PREFIX "d ",
+         mark_compact_speed_in_bytes_per_ms);
+  PrintF("incremental_marking_speed=%" V8_PTR_PREFIX "d ",
+         incremental_marking_speed_in_bytes_per_ms);
+ PrintF("scavenge_speed=%" V8_PTR_PREFIX "d ", scavenge_speed_in_bytes_per_ms);
+  PrintF("new_space_size=%" V8_PTR_PREFIX "d ", used_new_space_size);
+  PrintF("new_space_capacity=%" V8_PTR_PREFIX "d ", new_space_capacity);
+  PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d",
+         new_space_allocation_throughput_in_bytes_per_ms);
+}
+
+
 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 cae6936da2952f0c4fa5c18e1fad319e2421e082..afb177d41d6bf7e17bff52570d8cff620c9c9924 100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -116,7 +116,10 @@ class GCIdleTimeHandler {
   // If contexts are disposed at a higher rate a full gc is triggered.
   static const double kHighContextDisposalRate;

-  struct HeapState {
+  class HeapState {
+   public:
+    void Print();
+
     int contexts_disposed;
     double contexts_disposal_rate;
     size_t size_of_objects;
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 3c51b6e23f67e2af548057d590ac1f035b2dc039..9785be0b91d59785a5b38a6da7ac38006ed8bfa2 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4485,7 +4485,13 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
PrintF("Idle notification: requested idle time %d ms, actual time %d ms [",
            idle_time_in_ms, actual_time_in_ms);
     action.Print();
-    PrintF("]\n");
+    PrintF("]");
+    if (FLAG_trace_idle_notification_verbose) {
+      PrintF("[");
+      heap_state.Print();
+      PrintF("]");
+    }
+    PrintF("\n");
   }

   contexts_disposed_ = 0;


--
--
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