Index: src/heap/gc-tracer.h |
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h |
index 4e70f0741c5aaf0e05c9a7297bbbf972e6ce4527..2655f1f48cb1e5c5af39389b4d82859c6c8ef6ee 100644 |
--- a/src/heap/gc-tracer.h |
+++ b/src/heap/gc-tracer.h |
@@ -145,6 +145,19 @@ class GCTracer { |
intptr_t allocation_in_bytes_; |
}; |
+ |
+ class ContextDisposalEvent { |
+ public: |
+ // Default constructor leaves the event uninitialized. |
+ ContextDisposalEvent() {} |
+ |
+ explicit ContextDisposalEvent(double time); |
+ |
+ // Time when context disposal event happened. |
+ double time_; |
+ }; |
+ |
+ |
class Event { |
public: |
enum Type { SCAVENGER = 0, MARK_COMPACTOR = 1, START = 2 }; |
@@ -241,6 +254,9 @@ class GCTracer { |
typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; |
+ typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
+ ContextDisposalEventBuffer; |
+ |
explicit GCTracer(Heap* heap); |
// Start collecting data. |
@@ -253,6 +269,8 @@ class GCTracer { |
// Log an allocation throughput event. |
void AddNewSpaceAllocationTime(double duration, intptr_t allocation_in_bytes); |
+ void AddContextDisposalTime(double time); |
+ |
// Log an incremental marking step. |
void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
@@ -322,6 +340,12 @@ class GCTracer { |
// Returns 0 if no events have been recorded. |
intptr_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; |
+ // Computes the context disposal rate in milliseconds. It takes the time |
+ // frame of the first and last context disposal event and devides it by the |
+ // number of recorded events. |
+ // Returns 0 if no events have been recorded. |
+ double ContextDisposalRateInMilliseconds() const; |
+ |
private: |
// Print one detailed trace line in name=value format. |
// TODO(ernstm): Move to Heap. |
@@ -359,6 +383,8 @@ class GCTracer { |
// RingBuffer for allocation events. |
AllocationEventBuffer allocation_events_; |
+ ContextDisposalEventBuffer context_disposal_events_; |
+ |
// Cumulative number of incremental marking steps since creation of tracer. |
int cumulative_incremental_marking_steps_; |