Index: src/heap/gc-tracer.h |
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h |
index 6932eadfd8d4ea4298bed4ff9d06c0c488b5759a..a2e4bc293eefc4366d500fcc81ea945c828a33b0 100644 |
--- a/src/heap/gc-tracer.h |
+++ b/src/heap/gc-tracer.h |
@@ -159,6 +159,17 @@ class GCTracer { |
}; |
+ class SurvivalEvent { |
+ public: |
+ // Default constructor leaves the event uninitialized. |
+ SurvivalEvent() {} |
+ |
+ explicit SurvivalEvent(double survival_rate); |
+ |
+ double survival_rate_; |
+ }; |
+ |
+ |
class Event { |
public: |
enum Type { |
@@ -267,6 +278,8 @@ class GCTracer { |
typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
ContextDisposalEventBuffer; |
+ typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; |
+ |
explicit GCTracer(Heap* heap); |
// Start collecting data. |
@@ -281,6 +294,8 @@ class GCTracer { |
void AddContextDisposalTime(double time); |
+ void AddSurvivalRate(double survival_rate); |
+ |
// Log an incremental marking step. |
void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
@@ -367,6 +382,14 @@ class GCTracer { |
// Returns 0 if no events have been recorded. |
double ContextDisposalRateInMilliseconds() const; |
+ // Computes the average survival rate based on the last recorded survival |
+ // events. |
+ // Returns 0 if no events have been recorded. |
+ double AverageSurvivalRate() const; |
+ |
+ // Returns true if at least one survival event was recorded. |
+ bool SurvivalEventsRecorded() const; |
+ |
private: |
// Print one detailed trace line in name=value format. |
// TODO(ernstm): Move to Heap. |
@@ -417,8 +440,12 @@ class GCTracer { |
// RingBuffer for allocation events. |
AllocationEventBuffer allocation_events_; |
+ // RingBuffer for context disposal events. |
ContextDisposalEventBuffer context_disposal_events_; |
+ // RingBuffer for survival events. |
+ SurvivalEventBuffer survival_events_; |
+ |
// Cumulative number of incremental marking steps since creation of tracer. |
int cumulative_incremental_marking_steps_; |