Index: src/heap/gc-tracer.h |
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h |
index 1fad040d91e1cc686bcecd37ee0b2fbe8ebb4db2..96e202006b1e8e8099b9d1f54f28d12ce3d5f997 100644 |
--- a/src/heap/gc-tracer.h |
+++ b/src/heap/gc-tracer.h |
@@ -178,6 +178,18 @@ class GCTracer { |
}; |
+ class CompactionEvent { |
+ public: |
+ CompactionEvent() : duration(0), live_bytes_compacted(0) {} |
+ |
+ CompactionEvent(double duration, intptr_t live_bytes_compacted) |
+ : duration(duration), live_bytes_compacted(live_bytes_compacted) {} |
+ |
+ double duration; |
+ intptr_t live_bytes_compacted; |
+ }; |
+ |
+ |
class ContextDisposalEvent { |
public: |
// Default constructor leaves the event uninitialized. |
@@ -314,6 +326,8 @@ class GCTracer { |
typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
ContextDisposalEventBuffer; |
+ typedef RingBuffer<CompactionEvent, kRingBufferMaxSize> CompactionEventBuffer; |
+ |
typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; |
static const int kThroughputTimeFrameMs = 5000; |
@@ -336,6 +350,8 @@ class GCTracer { |
void AddContextDisposalTime(double time); |
+ void AddCompactionEvent(double duration, intptr_t live_bytes_compacted); |
+ |
void AddSurvivalRatio(double survival_ratio); |
// Log an incremental marking step. |
@@ -406,6 +422,10 @@ class GCTracer { |
intptr_t ScavengeSpeedInBytesPerMillisecond( |
ScavengeSpeedMode mode = kForAllObjects) const; |
+ // Compute the average compaction speed in bytes/millisecond. |
+ // Returns 0 if not enough events have been recorded. |
+ intptr_t CompactionSpeedInBytesPerMillisecond() const; |
+ |
// Compute the average mark-sweep speed in bytes/millisecond. |
// Returns 0 if no events have been recorded. |
intptr_t MarkCompactSpeedInBytesPerMillisecond() const; |
@@ -520,6 +540,9 @@ class GCTracer { |
// RingBuffer for context disposal events. |
ContextDisposalEventBuffer context_disposal_events_; |
+ // RingBuffer for compaction events. |
+ CompactionEventBuffer compaction_events_; |
+ |
// RingBuffer for survival events. |
SurvivalEventBuffer survival_events_; |