Revision: 12267
Author:   [email protected]
Date:     Tue Aug  7 01:19:11 2012
Log: Adjust GC tracing: add a flag to ignore scavenger traces and print total GC time in verbose mode.

[email protected]

Review URL: https://chromiumcodereview.appspot.com/10536147
http://code.google.com/p/v8/source/detail?r=12267

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h      Mon Jul 30 03:47:04 2012
+++ /branches/bleeding_edge/src/flag-definitions.h      Tue Aug  7 01:19:11 2012
@@ -362,6 +362,8 @@
 DEFINE_bool(trace_gc_nvp, false,
             "print one detailed trace line in name=value format "
             "after each garbage collection")
+DEFINE_bool(trace_gc_ignore_scavenger, false,
+            "do not print trace line after scavenger collection")
 DEFINE_bool(print_cumulative_gc_stat, false,
             "print cumulative GC statistics in name=value format on exit")
 DEFINE_bool(trace_gc_verbose, false,
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Aug  6 07:25:19 2012
+++ /branches/bleeding_edge/src/heap.cc Tue Aug  7 01:19:11 2012
@@ -139,6 +139,7 @@
       previous_survival_rate_trend_(Heap::STABLE),
       survival_rate_trend_(Heap::STABLE),
       max_gc_pause_(0),
+      total_gc_time_ms_(0),
       max_alive_after_gc_(0),
       min_in_mutator_(kMaxInt),
       alive_after_last_gc_(0),
@@ -369,6 +370,7 @@
            lo_space_->SizeOfObjects() / KB,
            lo_space_->Available() / KB,
            lo_space_->CommittedMemory() / KB);
+  PrintPID("Total time spent in GC  : %d ms\n", total_gc_time_ms_);
 }


@@ -6188,6 +6190,7 @@
     PrintF("gc_count=%d ", gc_count_);
     PrintF("mark_sweep_count=%d ", ms_count_);
     PrintF("max_gc_pause=%d ", get_max_gc_pause());
+    PrintF("total_gc_time=%d ", total_gc_time_ms_);
     PrintF("min_in_mutator=%d ", get_min_in_mutator());
     PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ",
            get_max_alive_after_gc());
@@ -6869,6 +6872,7 @@

   // Update cumulative GC statistics if required.
   if (FLAG_print_cumulative_gc_stat) {
+    heap_->total_gc_time_ms_ += time;
     heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time);
     heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_,
                                      heap_->alive_after_last_gc_);
@@ -6876,7 +6880,11 @@
       heap_->min_in_mutator_ = Min(heap_->min_in_mutator_,
                                    static_cast<int>(spent_in_mutator_));
     }
-  }
+  } else if (FLAG_trace_gc_verbose) {
+    heap_->total_gc_time_ms_ += time;
+  }
+
+  if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return;

   PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());

@@ -6920,9 +6928,7 @@
     PrintF(".\n");
   } else {
     PrintF("pause=%d ", time);
-    PrintF("mutator=%d ",
-           static_cast<int>(spent_in_mutator_));
-
+    PrintF("mutator=%d ", static_cast<int>(spent_in_mutator_));
     PrintF("gc=");
     switch (collector_) {
       case SCAVENGER:
=======================================
--- /branches/bleeding_edge/src/heap.h  Wed Aug  1 02:43:05 2012
+++ /branches/bleeding_edge/src/heap.h  Tue Aug  7 01:19:11 2012
@@ -2055,6 +2055,9 @@
   // Maximum GC pause.
   int max_gc_pause_;

+  // Total time spent in GC.
+  int total_gc_time_ms_;
+
   // Maximum size of objects alive after GC.
   intptr_t max_alive_after_gc_;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to