Reviewers: Hannes Payer, jochen,

Message:
PTAL

Description:
Always trace garbage collection events in GCTracer.

- always trace events in GCTracer, but only print stats when the command
  line flag is set.
- required to collect statistis that will be used to schedue garbage
  collection.
- we need to watch the perf bots after this lands, as it could regress
  performance.

[email protected]
BUG=

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

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

Affected files (+9, -17 lines):
  M src/gc-tracer.cc
  M src/incremental-marking.cc


Index: src/gc-tracer.cc
diff --git a/src/gc-tracer.cc b/src/gc-tracer.cc
index 3b381b3ad9c0c4b1843311edbc57122a1a526da0..6119867692599d3e0340e734c80fbbfda7a126ab 100644
--- a/src/gc-tracer.cc
+++ b/src/gc-tracer.cc
@@ -78,8 +78,6 @@ GCTracer::GCTracer(Heap* heap)

 void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
                      const char* collector_reason) {
-  if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
-
   previous_ = current_;
   if (current_.type == Event::MARK_COMPACTOR)
     previous_mark_compactor_event_ = current_;
@@ -106,8 +104,6 @@ void GCTracer::Start(GarbageCollector collector, const char* gc_reason,


 void GCTracer::Stop() {
-  if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
-
   current_.end_time = base::OS::TimeCurrentMillis();
   current_.end_object_size = heap_->SizeOfObjects();
   current_.end_memory_size = heap_->isolate()->memory_allocator()->Size();
@@ -122,6 +118,10 @@ void GCTracer::Stop() {
   if (current_.type == Event::MARK_COMPACTOR)
     longest_incremental_marking_step_ = 0.0;

+  // TODO(ernstm): move the code below out of GCTracer.
+
+  if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
+
   double duration = current_.end_time - current_.start_time;
double spent_in_mutator = Max(current_.start_time - previous_.end_time, 0.0);

Index: src/incremental-marking.cc
diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc
index 011e160bdc4d01fac02c7ac809bfd7b767f27453..d3df705c2169ea81a715c4b212e961eb50abdf84 100644
--- a/src/incremental-marking.cc
+++ b/src/incremental-marking.cc
@@ -866,12 +866,7 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,

   bytes_scanned_ += bytes_to_process;

-  double start = 0;
-
-  if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
-      FLAG_print_cumulative_gc_stat) {
-    start = base::OS::TimeCurrentMillis();
-  }
+  double start = base::OS::TimeCurrentMillis();

   if (state_ == SWEEPING) {
     if (heap_->mark_compact_collector()->sweeping_in_progress() &&
@@ -952,13 +947,10 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,
     }
   }

-  if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
-      FLAG_print_cumulative_gc_stat) {
-    double end = base::OS::TimeCurrentMillis();
-    double delta = (end - start);
-    heap_->tracer()->AddIncrementalMarkingStep(delta);
-    heap_->AddMarkingTime(delta);
-  }
+  double end = base::OS::TimeCurrentMillis();
+  double delta = (end - start);
+  heap_->tracer()->AddIncrementalMarkingStep(delta);
+  heap_->AddMarkingTime(delta);
 }




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