Chromium Code Reviews| Index: src/heap/gc-tracer.cc |
| diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc |
| index 927915d7554bae15b4e26c43b997734824f8c231..2f48d92e44db2f0af25f2a27df23f49afd74b4bc 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); |
|
ulan
2015/05/21 15:21:25
(+ 1) to avoid returning 0 if allocated_bytes < kT
Hannes Payer (out of office)
2015/05/21 17:17:03
Done.
|
| +} |
| + |
| + |
| double GCTracer::ContextDisposalRateInMilliseconds() const { |
| if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0; |