Index: src/heap/gc-tracer.cc |
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc |
index 2854e452f127488c6ecccacaf716b977a8d2ce35..a37b832358e3f90a3198668ac81f2d29f027d35c 100644 |
--- a/src/heap/gc-tracer.cc |
+++ b/src/heap/gc-tracer.cc |
@@ -309,6 +309,13 @@ void GCTracer::AddContextDisposalTime(double time) { |
} |
+void GCTracer::AddCompactionEvent(double duration, |
+ intptr_t live_bytes_compacted) { |
+ compaction_events_.push_front( |
+ CompactionEvent(duration, live_bytes_compacted)); |
+} |
+ |
+ |
void GCTracer::AddSurvivalRatio(double promotion_ratio) { |
survival_events_.push_front(SurvivalEvent(promotion_ratio)); |
} |
@@ -535,7 +542,8 @@ void GCTracer::PrintNVP() const { |
"semi_space_copy_rate=%.1f%% " |
"new_space_allocation_throughput=%" V8_PTR_PREFIX |
"d " |
- "context_disposal_rate=%.1f\n", |
+ "context_disposal_rate=%.1f " |
+ "compaction_speed=%" V8_PTR_PREFIX "d\n", |
heap_->isolate()->time_millis_since_init(), duration, |
spent_in_mutator, current_.TypeName(true), |
current_.reduce_memory, current_.scopes[Scope::EXTERNAL], |
@@ -585,7 +593,8 @@ void GCTracer::PrintNVP() const { |
heap_->promotion_ratio_, AverageSurvivalRatio(), |
heap_->promotion_rate_, heap_->semi_space_copied_rate_, |
NewSpaceAllocationThroughputInBytesPerMillisecond(), |
- ContextDisposalRateInMilliseconds()); |
+ ContextDisposalRateInMilliseconds(), |
+ CompactionSpeedInBytesPerMillisecond()); |
break; |
case Event::START: |
break; |
@@ -706,6 +715,23 @@ intptr_t GCTracer::ScavengeSpeedInBytesPerMillisecond( |
} |
+intptr_t GCTracer::CompactionSpeedInBytesPerMillisecond() const { |
+ if (compaction_events_.size() < kRingBufferMaxSize) return 0.0; |
+ intptr_t bytes = 0; |
+ double durations = 0.0; |
+ CompactionEventBuffer::const_iterator iter = compaction_events_.begin(); |
+ while (iter != compaction_events_.end()) { |
+ bytes += iter->live_bytes_compacted; |
+ durations += iter->duration; |
+ ++iter; |
+ } |
+ |
+ if (durations == 0.0) return 0; |
+ // Make sure the result is at least 1. |
+ return Max<intptr_t>(static_cast<intptr_t>(bytes / durations + 0.5), 1); |
+} |
+ |
+ |
intptr_t GCTracer::MarkCompactSpeedInBytesPerMillisecond() const { |
intptr_t bytes = 0; |
double durations = 0.0; |