OSDN Git Service

Track cumulative objects and bytes copied for CC
authorMathieu Chartier <mathieuc@google.com>
Wed, 17 Aug 2016 17:07:29 +0000 (10:07 -0700)
committerMathieu Chartier <mathieuc@google.com>
Wed, 17 Aug 2016 17:10:37 +0000 (10:10 -0700)
Also print out these values when dumping GC performance info.

Bug: 12687968

Test: Test that values are reasonable after running EAAC.

Change-Id: Id04fadeaf52511560fd4b261f5287ea0a5dae9d4

runtime/gc/collector/concurrent_copying.cc
runtime/gc/collector/concurrent_copying.h

index 70faf4b..7afe6f9 100644 (file)
@@ -1508,7 +1508,9 @@ void ConcurrentCopying::ReclaimPhase() {
     uint64_t unevac_from_bytes = region_space_->GetBytesAllocatedInUnevacFromSpace();
     uint64_t unevac_from_objects = region_space_->GetObjectsAllocatedInUnevacFromSpace();
     uint64_t to_bytes = bytes_moved_.LoadSequentiallyConsistent();
+    cumulative_bytes_moved_.FetchAndAddRelaxed(to_bytes);
     uint64_t to_objects = objects_moved_.LoadSequentiallyConsistent();
+    cumulative_objects_moved_.FetchAndAddRelaxed(to_objects);
     if (kEnableFromSpaceAccountingCheck) {
       CHECK_EQ(from_space_num_objects_at_first_pause_, from_objects + unevac_from_objects);
       CHECK_EQ(from_space_num_bytes_at_first_pause_, from_bytes + unevac_from_bytes);
@@ -2360,6 +2362,8 @@ void ConcurrentCopying::DumpPerformanceInfo(std::ostream& os) {
   if (rb_slow_path_count_gc_total_ > 0) {
     os << "GC slow path count " << rb_slow_path_count_gc_total_ << "\n";
   }
+  os << "Cumulative bytes moved " << cumulative_bytes_moved_.LoadRelaxed() << "\n";
+  os << "Cumulative objects moved " << cumulative_objects_moved_.LoadRelaxed() << "\n";
 }
 
 }  // namespace collector
index 55c4570..5b0e2d6 100644 (file)
@@ -272,6 +272,8 @@ class ConcurrentCopying : public GarbageCollector {
   // How many objects and bytes we moved. Used for accounting.
   Atomic<size_t> bytes_moved_;
   Atomic<size_t> objects_moved_;
+  Atomic<uint64_t> cumulative_bytes_moved_;
+  Atomic<uint64_t> cumulative_objects_moved_;
 
   // The skipped blocks are memory blocks/chucks that were copies of
   // objects that were unused due to lost races (cas failures) at