Trace scavenger throughput.
authorulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 19 Aug 2014 12:07:59 +0000 (12:07 +0000)
committerulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 19 Aug 2014 12:07:59 +0000 (12:07 +0000)
BUG=
R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/487753003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23195 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap/gc-tracer.cc
src/heap/gc-tracer.h

index 12de0e4..a0f1c46 100644 (file)
@@ -103,6 +103,8 @@ void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
   current_.start_object_size = heap_->SizeOfObjects();
   current_.start_memory_size = heap_->isolate()->memory_allocator()->Size();
   current_.start_holes_size = CountTotalHolesSize(heap_);
+  current_.new_space_object_size =
+      heap_->new_space()->top() - heap_->new_space()->bottom();
 
   current_.cumulative_incremental_marking_steps =
       cumulative_incremental_marking_steps_;
@@ -296,6 +298,8 @@ void GCTracer::PrintNVP() const {
   if (current_.type == Event::SCAVENGER) {
     PrintF("steps_count=%d ", current_.incremental_marking_steps);
     PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
+    PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ",
+           ScavengeSpeedInBytesPerMillisecond());
   } else {
     PrintF("steps_count=%d ", current_.incremental_marking_steps);
     PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
@@ -398,5 +402,21 @@ intptr_t GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond() const {
 
   return static_cast<intptr_t>(bytes / durations);
 }
+
+
+intptr_t GCTracer::ScavengeSpeedInBytesPerMillisecond() const {
+  intptr_t bytes = 0;
+  double durations = 0.0;
+  EventBuffer::const_iterator iter = scavenger_events_.begin();
+  while (iter != scavenger_events_.end()) {
+    bytes += iter->new_space_object_size;
+    durations += iter->end_time - iter->start_time;
+    ++iter;
+  }
+
+  if (durations == 0.0) return 0;
+
+  return static_cast<intptr_t>(bytes / durations);
+}
 }
 }  // namespace v8::internal
index 14281a4..fd53d3c 100644 (file)
@@ -171,6 +171,9 @@ class GCTracer BASE_EMBEDDED {
     // after the current GC.
     intptr_t end_holes_size;
 
+    // Size of new space objects in constructor.
+    intptr_t new_space_object_size;
+
     // Number of incremental marking steps since creation of tracer.
     // (value at start of event)
     int cumulative_incremental_marking_steps;
@@ -280,10 +283,14 @@ class GCTracer BASE_EMBEDDED {
   // Returns 0 if no incremental marking round has been completed.
   double MaxIncrementalMarkingDuration() const;
 
-  // Compute the average incremental marking speed in bytes/second. Returns 0 if
-  // no events have been recorded.
+  // Compute the average incremental marking speed in bytes/millisecond.
+  // Returns 0 if no events have been recorded.
   intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const;
 
+  // Compute the average scavenge speed in bytes/millisecond.
+  // Returns 0 if no events have been recorded.
+  intptr_t ScavengeSpeedInBytesPerMillisecond() const;
+
  private:
   // Print one detailed trace line in name=value format.
   // TODO(ernstm): Move to Heap.