Index: src/heap/gc-tracer.cc |
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc |
index 927915d7554bae15b4e26c43b997734824f8c231..815baa440c308bf4fd619929e74a09db7fa11cf3 100644 |
--- a/src/heap/gc-tracer.cc |
+++ b/src/heap/gc-tracer.cc |
@@ -610,7 +610,7 @@ size_t GCTracer::NewSpaceAllocatedBytesInLast(double time_ms) const { |
++iter; |
} |
- if (durations < time_ms) return 0; |
+ if (durations == 0.0) return 0; |
bytes = static_cast<size_t>(bytes * (time_ms / durations) + 0.5); |
// Return at least 1 since 0 means "no data". |
@@ -618,6 +618,15 @@ size_t GCTracer::NewSpaceAllocatedBytesInLast(double time_ms) const { |
} |
+size_t GCTracer::CurrentNewSpaceAllocationThroughputInBytesPerMillisecond() |
+ const { |
+ static const double kThroughputTimeFrame = 5000; |
+ size_t allocated_bytes = NewSpaceAllocatedBytesInLast(kThroughputTimeFrame); |
+ if (allocated_bytes == 0) return 0; |
+ return static_cast<size_t>((allocated_bytes / kThroughputTimeFrame) + 1); |
+} |
+ |
+ |
double GCTracer::ContextDisposalRateInMilliseconds() const { |
if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0; |