Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: src/heap/gc-tracer.h

Issue 2269093002: [heap] GCTracer: Record details for incremental marking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tracer-reland
Patch Set: Fix regression in ::Stop and inline ::AddScopeSample Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/gc-tracer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/gc-tracer.h
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h
index 531bba3cea78090e3cc47c5c48e54f3d0547655a..a11823e984f63ba1f25c3ddcca0c607e81571b50 100644
--- a/src/heap/gc-tracer.h
+++ b/src/heap/gc-tracer.h
@@ -60,12 +60,15 @@ inline BytesAndDuration MakeBytesAndDuration(uint64_t bytes, double duration) {
enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
-#define INCREMENTAL_SCOPES(F) \
- F(MC_INCREMENTAL_WRAPPER_PROLOGUE) \
- F(MC_INCREMENTAL_WRAPPER_TRACING) \
- F(MC_INCREMENTAL_FINALIZE) \
- F(MC_INCREMENTAL_FINALIZE_OBJECT_GROUPING) \
- F(MC_INCREMENTAL_EXTERNAL_EPILOGUE) \
+#define INCREMENTAL_SCOPES(F) \
+ /* MC_INCREMENTAL is the top-level incremental marking scope. */ \
+ F(MC_INCREMENTAL) \
+ F(MC_INCREMENTAL_WRAPPER_PROLOGUE) \
+ F(MC_INCREMENTAL_WRAPPER_TRACING) \
+ F(MC_INCREMENTAL_FINALIZE) \
+ F(MC_INCREMENTAL_FINALIZE_BODY) \
+ F(MC_INCREMENTAL_FINALIZE_OBJECT_GROUPING) \
+ F(MC_INCREMENTAL_EXTERNAL_EPILOGUE) \
F(MC_INCREMENTAL_EXTERNAL_PROLOGUE)
#define TRACER_SCOPES(F) \
@@ -128,9 +131,30 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
// GCTracer collects and prints ONE line after each garbage collector
// invocation IFF --trace_gc is used.
-// TODO(ernstm): Unit tests.
class GCTracer {
public:
+ struct IncrementalMarkingInfos {
+ IncrementalMarkingInfos()
+ : cumulative_duration(0), longest_step(0), steps(0) {}
+
+ void Update(double duration) {
+ steps++;
+ cumulative_duration += duration;
+ if (duration > longest_step) {
+ longest_step = duration;
+ }
+ }
+
+ void ResetCurrentCycle() {
+ longest_step = 0;
+ steps = 0;
+ }
+
+ double cumulative_duration;
+ double longest_step;
+ int steps;
+ };
+
class Scope {
public:
enum ScopeId {
@@ -139,7 +163,7 @@ class GCTracer {
#undef DEFINE_SCOPE
NUMBER_OF_SCOPES,
- FIRST_INCREMENTAL_SCOPE = MC_INCREMENTAL_WRAPPER_PROLOGUE,
+ FIRST_INCREMENTAL_SCOPE = MC_INCREMENTAL,
LAST_INCREMENTAL_SCOPE = MC_INCREMENTAL_EXTERNAL_PROLOGUE,
NUMBER_OF_INCREMENTAL_SCOPES =
LAST_INCREMENTAL_SCOPE - FIRST_INCREMENTAL_SCOPE + 1
@@ -168,9 +192,6 @@ class GCTracer {
START = 3
};
- // Default constructor leaves the event uninitialized.
- Event() {}
-
Event(Type type, const char* gc_reason, const char* collector_reason);
// Returns a string describing the event type.
@@ -213,19 +234,10 @@ class GCTracer {
// Size of new space objects in constructor.
intptr_t new_space_object_size;
+
// Size of survived new space objects in destructor.
intptr_t survived_new_space_object_size;
- // Number of incremental marking steps since creation of tracer.
- // (value at start of event)
- int cumulative_incremental_marking_steps;
-
- // Incremental marking steps since
- // - last event for SCAVENGER events
- // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR
- // events
- int incremental_marking_steps;
-
// Bytes marked since creation of tracer (value at start of event).
intptr_t cumulative_incremental_marking_bytes;
@@ -235,16 +247,6 @@ class GCTracer {
// events
intptr_t incremental_marking_bytes;
- // Cumulative duration of incremental marking steps since creation of
- // tracer. (value at start of event)
- double cumulative_incremental_marking_duration;
-
- // Duration of incremental marking steps since
- // - last event for SCAVENGER events
- // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR
- // events
- double incremental_marking_duration;
-
// Cumulative pure duration of incremental marking steps since creation of
// tracer. (value at start of event)
double cumulative_pure_incremental_marking_duration;
@@ -255,37 +257,12 @@ class GCTracer {
// events
double pure_incremental_marking_duration;
- // Longest incremental marking step since start of marking (start of event).
- double longest_incremental_marking_step;
-
- // Number of incremental marking finalization steps since creation of
- // tracer.
- int cumulative_incremental_marking_finalization_steps;
-
- // Cumulative pure duration of incremental marking steps since creation of
- // tracer. (value at start of event)
- double cumulative_incremental_marking_finalizaton_duration;
-
- // Longest incremental marking finalization step since start of marking
- // (start of event).
- double longest_incremental_marking_finalization_step;
-
- // Incremental marking finalization steps since
- // - last event for SCAVENGER events
- // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR
- // events
- int incremental_marking_finalizaton_steps;
-
- // Duration of incremental marking finalization steps since
- // - last event for SCAVENGER events
- // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR
- // events
- double incremental_marking_finalization_duration;
-
- double cumulative_incremental_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES];
-
// Amounts of time spent in different scopes during GC.
double scopes[Scope::NUMBER_OF_SCOPES];
+
+ // Holds details for incremental marking scopes.
+ IncrementalMarkingInfos
+ incremental_marking_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES];
};
static const int kThroughputTimeFrameMs = 5000;
@@ -315,8 +292,6 @@ class GCTracer {
// Log an incremental marking step.
void AddIncrementalMarkingStep(double duration, intptr_t bytes);
- void AddIncrementalMarkingFinalizationStep(double duration);
-
// Log time spent in marking.
void AddMarkingTime(double duration) {
cumulative_marking_duration_ += duration;
@@ -406,7 +381,15 @@ class GCTracer {
// Discard all recorded survival events.
void ResetSurvivalEvents();
- void AddScopeSample(Scope::ScopeId scope, double duration);
+ V8_INLINE void AddScopeSample(Scope::ScopeId scope, double duration) {
+ DCHECK(scope < Scope::NUMBER_OF_SCOPES);
+ if (scope >= Scope::FIRST_INCREMENTAL_SCOPE &&
+ scope <= Scope::LAST_INCREMENTAL_SCOPE) {
+ incremental_marking_scopes_[scope].Update(duration);
+ } else {
+ current_.scopes[scope] += duration;
+ }
+ }
private:
FRIEND_TEST(GCTracer, AverageSpeed);
@@ -415,6 +398,7 @@ class GCTracer {
FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughputWithProvidedTime);
FRIEND_TEST(GCTracerTest, OldGenerationAllocationThroughputWithProvidedTime);
FRIEND_TEST(GCTracerTest, RegularScope);
+ FRIEND_TEST(GCTracerTest, IncrementalMarkingDetails);
FRIEND_TEST(GCTracerTest, IncrementalScope);
// Returns the average speed of the events in the buffer.
@@ -424,6 +408,8 @@ class GCTracer {
static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer,
const BytesAndDuration& initial, double time_ms);
+ void MergeBaseline(const Event& baseline);
+
void ResetForTesting();
// Print one detailed trace line in name=value format.
@@ -438,19 +424,6 @@ class GCTracer {
// it can be included in later crash dumps.
void PRINTF_FORMAT(2, 3) Output(const char* format, ...) const;
- void ClearMarkCompactStatistics() {
- cumulative_incremental_marking_steps_ = 0;
- cumulative_incremental_marking_bytes_ = 0;
- cumulative_incremental_marking_duration_ = 0;
- cumulative_pure_incremental_marking_duration_ = 0;
- longest_incremental_marking_step_ = 0;
- cumulative_incremental_marking_finalization_steps_ = 0;
- cumulative_incremental_marking_finalization_duration_ = 0;
- longest_incremental_marking_finalization_step_ = 0;
- cumulative_marking_duration_ = 0;
- cumulative_sweeping_duration_ = 0;
- }
-
double TotalExternalTime() const {
return current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES] +
current_.scopes[Scope::MC_EXTERNAL_EPILOGUE] +
@@ -474,9 +447,6 @@ class GCTracer {
// Previous INCREMENTAL_MARK_COMPACTOR event.
Event previous_incremental_mark_compactor_event_;
- // Cumulative number of incremental marking steps since creation of tracer.
- int cumulative_incremental_marking_steps_;
-
// Cumulative size of incremental marking steps (in bytes) since creation of
// tracer.
intptr_t cumulative_incremental_marking_bytes_;
@@ -488,27 +458,14 @@ class GCTracer {
// tracer.
double cumulative_pure_incremental_marking_duration_;
- // Longest incremental marking step since start of marking.
- double longest_incremental_marking_step_;
-
- // Cumulative number of incremental marking finalization steps since creation
- // of tracer.
- int cumulative_incremental_marking_finalization_steps_;
-
- // Cumulative duration of incremental marking finalization steps since
- // creation of tracer.
- double cumulative_incremental_marking_finalization_duration_;
-
- // Longest incremental marking finalization step since start of marking.
- double longest_incremental_marking_finalization_step_;
-
// Total marking time.
// This timer is precise when run with --print-cumulative-gc-stat
double cumulative_marking_duration_;
- // Cumulative duration of incremental marking scopes since the creation of
- // the tracer.
- double cumulative_incremental_scopes_[Scope::NUMBER_OF_INCREMENTAL_SCOPES];
+ // Incremental scopes carry more information than just the duration. The infos
+ // here are merged back upon starting/stopping the GC tracer.
+ IncrementalMarkingInfos
+ incremental_marking_scopes_[Scope::NUMBER_OF_INCREMENTAL_SCOPES];
// Total sweeping time on the main thread.
// This timer is precise when run with --print-cumulative-gc-stat
« no previous file with comments | « no previous file | src/heap/gc-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698