Reviewers: Hannes Payer,

Message:
PTAL

Description:
Trace scavenger throughput.

BUG=

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

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

Affected files (+29, -2 lines):
  M src/heap/gc-tracer.h
  M src/heap/gc-tracer.cc


Index: src/heap/gc-tracer.cc
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc
index 12de0e457e500d47ca8e77b1dffff435b53fd12a..a0f1c464cc26f33d1dae45c36a1f5ac76a606a6c 100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -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: src/heap/gc-tracer.h
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h
index 14281a4c8d90bcd7988ad58833db47381775b351..fd53d3c31ce7121c49f836e1bcf46546e32d5ac4 100644
--- a/src/heap/gc-tracer.h
+++ b/src/heap/gc-tracer.h
@@ -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.


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