Reviewers: Michael Starzinger,

Description:
Print promotion rate and semi-space copy rate in --trace-gc-nvp.

BUG=

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

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

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


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 5d338b2122374a163e083aca1453c7c135bc4c0b..d6503cf7b7c62bbbd055bf502c512608db993cf2 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2056,7 +2056,9 @@ class ScavengingVisitor : public StaticVisitorBase {
           }
         }

-        heap->tracer()->increment_promoted_objects_size(object_size);
+        if (FLAG_trace_gc) {
+          heap->tracer()->increment_promoted_objects_size(object_size);
+        }
         return;
       }
     }
@@ -2075,6 +2077,9 @@ class ScavengingVisitor : public StaticVisitorBase {
     // buffer.
     *slot = target;
     MigrateObject(heap, object, target, object_size);
+    if (FLAG_trace_gc) {
+      heap->tracer()->increment_semi_space_copied_object_size(object_size);
+    }
     return;
   }

@@ -6029,6 +6034,7 @@ GCTracer::GCTracer(Heap* heap,
       allocated_since_last_gc_(0),
       spent_in_mutator_(0),
       promoted_objects_size_(0),
+      semi_space_copied_object_size_(0),
       nodes_died_in_new_space_(0),
       nodes_copied_in_new_space_(0),
       nodes_promoted_(0),
@@ -6176,10 +6182,18 @@ GCTracer::~GCTracer() {

     PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
     PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_);
+    PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
+        semi_space_copied_object_size_);
     PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_);
     PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_);
     PrintF("nodes_promoted=%d ", nodes_promoted_);
-    PrintF("survived=%.1f%% ", heap_->survival_rate_);
+    PrintF("survival_rate=%.1f%% ", heap_->survival_rate_);
+    PrintF("promotion_rate=%.1f%% ",
+        (static_cast<double>(promoted_objects_size_) /
+            static_cast<double>(heap_->new_space()->Capacity())) * 100);
+    PrintF("semi_space_copy_rate=%.1f%% ",
+        (static_cast<double>(semi_space_copied_object_size_) /
+            static_cast<double>(heap_->new_space()->Capacity())) * 100);

     if (collector_ == SCAVENGER) {
       PrintF("stepscount=%d ", steps_count_since_last_gc_);
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index d0d35473912f9588981f1924c5df16eedbe40268..074754c8665127668d711eea949db2d61bf2990e 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -2604,6 +2604,10 @@ class GCTracer BASE_EMBEDDED {
     promoted_objects_size_ += object_size;
   }

+  void increment_semi_space_copied_object_size(int object_size) {
+    semi_space_copied_object_size_ += object_size;
+  }
+
   void increment_nodes_died_in_new_space() {
     nodes_died_in_new_space_++;
   }
@@ -2660,6 +2664,10 @@ class GCTracer BASE_EMBEDDED {
   // Size of objects promoted during the current collection.
   intptr_t promoted_objects_size_;

+  // Size of objects copied to the other semi-space during the current
+  // collection.
+  intptr_t semi_space_copied_object_size_;
+
   // Number of died nodes in the new space.
   int nodes_died_in_new_space_;



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