Index: src/heap/gc-tracer.cc |
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc |
index ffe48d5d5fee6173e3fc38aefb3872277090b36c..0bd12cdb5ba1ce60f724e586fe19c04d96a0026d 100644 |
--- a/src/heap/gc-tracer.cc |
+++ b/src/heap/gc-tracer.cc |
@@ -31,6 +31,11 @@ GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) { |
} |
+GCTracer::SurvivalEvent::SurvivalEvent(double survival_rate) { |
+ survival_rate_ = survival_rate; |
+} |
+ |
+ |
GCTracer::Event::Event(Type type, const char* gc_reason, |
const char* collector_reason) |
: type(type), |
@@ -252,6 +257,11 @@ void GCTracer::AddContextDisposalTime(double time) { |
} |
+void GCTracer::AddSurvivalRate(double survival_rate) { |
+ survival_events_.push_front(SurvivalEvent(survival_rate)); |
+} |
+ |
+ |
void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { |
cumulative_incremental_marking_steps_++; |
cumulative_incremental_marking_bytes_ += bytes; |
@@ -361,8 +371,10 @@ void GCTracer::PrintNVP() const { |
PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); |
PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); |
PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); |
+ PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); |
PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); |
PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); |
+ PrintF("average_survival_rate%.1f%% ", AverageSurvivalRate()); |
PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", |
NewSpaceAllocationThroughputInBytesPerMillisecond()); |
PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); |
@@ -556,5 +568,24 @@ double GCTracer::ContextDisposalRateInMilliseconds() const { |
return (begin - end) / context_disposal_events_.size(); |
} |
+ |
+ |
+double GCTracer::AverageSurvivalRate() const { |
+ if (survival_events_.size() == 0) return 0.0; |
+ |
+ double sum_of_rates = 0.0; |
+ SurvivalEventBuffer::const_iterator iter = survival_events_.begin(); |
+ while (iter != survival_events_.end()) { |
+ sum_of_rates += iter->survival_rate_; |
+ ++iter; |
+ } |
+ |
+ return sum_of_rates / static_cast<double>(survival_events_.size()); |
+} |
+ |
+ |
+bool GCTracer::SurvivalEventsRecorded() const { |
+ return survival_events_.size() > 0; |
+} |
} |
} // namespace v8::internal |