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

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

Issue 2273673002: Reland of "[heap] Tracer: Handle incremental marking scopes" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: GCTracer::ResetForTesting: cover new members 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 ed07750a4a91464701692e20943521b378417388..531bba3cea78090e3cc47c5c48e54f3d0547655a 100644
--- a/src/heap/gc-tracer.h
+++ b/src/heap/gc-tracer.h
@@ -9,6 +9,7 @@
#include "src/base/platform/platform.h"
#include "src/counters.h"
#include "src/globals.h"
+#include "testing/gtest/include/gtest/gtest_prod.h"
namespace v8 {
namespace internal {
@@ -59,54 +60,64 @@ inline BytesAndDuration MakeBytesAndDuration(uint64_t bytes, double duration) {
enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
-#define TRACER_SCOPES(F) \
- F(EXTERNAL_WEAK_GLOBAL_HANDLES) \
- F(MC_CLEAR) \
- F(MC_CLEAR_CODE_FLUSH) \
- F(MC_CLEAR_DEPENDENT_CODE) \
- F(MC_CLEAR_GLOBAL_HANDLES) \
- F(MC_CLEAR_MAPS) \
- F(MC_CLEAR_SLOTS_BUFFER) \
- F(MC_CLEAR_STORE_BUFFER) \
- F(MC_CLEAR_STRING_TABLE) \
- F(MC_CLEAR_WEAK_CELLS) \
- F(MC_CLEAR_WEAK_COLLECTIONS) \
- F(MC_CLEAR_WEAK_LISTS) \
- F(MC_EVACUATE) \
- F(MC_EVACUATE_CANDIDATES) \
- F(MC_EVACUATE_CLEAN_UP) \
- F(MC_EVACUATE_COPY) \
- F(MC_EVACUATE_UPDATE_POINTERS) \
- F(MC_EVACUATE_UPDATE_POINTERS_TO_EVACUATED) \
- F(MC_EVACUATE_UPDATE_POINTERS_TO_NEW) \
- F(MC_EVACUATE_UPDATE_POINTERS_WEAK) \
- F(MC_EXTERNAL_EPILOGUE) \
- F(MC_EXTERNAL_PROLOGUE) \
- F(MC_FINISH) \
- F(MC_INCREMENTAL_FINALIZE) \
- F(MC_INCREMENTAL_EXTERNAL_EPILOGUE) \
- F(MC_INCREMENTAL_EXTERNAL_PROLOGUE) \
- F(MC_MARK) \
- F(MC_MARK_FINISH_INCREMENTAL) \
- F(MC_MARK_PREPARE_CODE_FLUSH) \
- F(MC_MARK_ROOTS) \
- F(MC_MARK_WEAK_CLOSURE) \
- F(MC_MARK_WEAK_CLOSURE_EPHEMERAL) \
- F(MC_MARK_WEAK_CLOSURE_WEAK_HANDLES) \
- F(MC_MARK_WEAK_CLOSURE_WEAK_ROOTS) \
- F(MC_MARK_WEAK_CLOSURE_HARMONY) \
- F(MC_SWEEP) \
- F(MC_SWEEP_CODE) \
- F(MC_SWEEP_MAP) \
- F(MC_SWEEP_OLD) \
- F(SCAVENGER_CODE_FLUSH_CANDIDATES) \
- F(SCAVENGER_EXTERNAL_EPILOGUE) \
- F(SCAVENGER_EXTERNAL_PROLOGUE) \
- F(SCAVENGER_OBJECT_GROUPS) \
- F(SCAVENGER_OLD_TO_NEW_POINTERS) \
- F(SCAVENGER_ROOTS) \
- F(SCAVENGER_SCAVENGE) \
- F(SCAVENGER_SEMISPACE) \
+#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) \
+ F(MC_INCREMENTAL_EXTERNAL_PROLOGUE)
+
+#define TRACER_SCOPES(F) \
+ INCREMENTAL_SCOPES(F) \
+ F(EXTERNAL_WEAK_GLOBAL_HANDLES) \
+ F(MC_CLEAR) \
+ F(MC_CLEAR_CODE_FLUSH) \
+ F(MC_CLEAR_DEPENDENT_CODE) \
+ F(MC_CLEAR_GLOBAL_HANDLES) \
+ F(MC_CLEAR_MAPS) \
+ F(MC_CLEAR_SLOTS_BUFFER) \
+ F(MC_CLEAR_STORE_BUFFER) \
+ F(MC_CLEAR_STRING_TABLE) \
+ F(MC_CLEAR_WEAK_CELLS) \
+ F(MC_CLEAR_WEAK_COLLECTIONS) \
+ F(MC_CLEAR_WEAK_LISTS) \
+ F(MC_EVACUATE) \
+ F(MC_EVACUATE_CANDIDATES) \
+ F(MC_EVACUATE_CLEAN_UP) \
+ F(MC_EVACUATE_COPY) \
+ F(MC_EVACUATE_UPDATE_POINTERS) \
+ F(MC_EVACUATE_UPDATE_POINTERS_TO_EVACUATED) \
+ F(MC_EVACUATE_UPDATE_POINTERS_TO_NEW) \
+ F(MC_EVACUATE_UPDATE_POINTERS_WEAK) \
+ F(MC_EXTERNAL_EPILOGUE) \
+ F(MC_EXTERNAL_PROLOGUE) \
+ F(MC_FINISH) \
+ F(MC_MARK) \
+ F(MC_MARK_FINISH_INCREMENTAL) \
+ F(MC_MARK_PREPARE_CODE_FLUSH) \
+ F(MC_MARK_ROOTS) \
+ F(MC_MARK_WEAK_CLOSURE) \
+ F(MC_MARK_WEAK_CLOSURE_EPHEMERAL) \
+ F(MC_MARK_WEAK_CLOSURE_WEAK_HANDLES) \
+ F(MC_MARK_WEAK_CLOSURE_WEAK_ROOTS) \
+ F(MC_MARK_WEAK_CLOSURE_HARMONY) \
+ F(MC_MARK_WRAPPER_EPILOGUE) \
+ F(MC_MARK_WRAPPER_PROLOGUE) \
+ F(MC_MARK_WRAPPER_TRACING) \
+ F(MC_MARK_OBJECT_GROUPING) \
+ F(MC_SWEEP) \
+ F(MC_SWEEP_CODE) \
+ F(MC_SWEEP_MAP) \
+ F(MC_SWEEP_OLD) \
+ F(SCAVENGER_CODE_FLUSH_CANDIDATES) \
+ F(SCAVENGER_EXTERNAL_EPILOGUE) \
+ F(SCAVENGER_EXTERNAL_PROLOGUE) \
+ F(SCAVENGER_OBJECT_GROUPS) \
+ F(SCAVENGER_OLD_TO_NEW_POINTERS) \
+ F(SCAVENGER_ROOTS) \
+ F(SCAVENGER_SCAVENGE) \
+ F(SCAVENGER_SEMISPACE) \
F(SCAVENGER_WEAK)
#define TRACE_GC(tracer, scope_id) \
@@ -126,7 +137,12 @@ class GCTracer {
#define DEFINE_SCOPE(scope) scope,
TRACER_SCOPES(DEFINE_SCOPE)
#undef DEFINE_SCOPE
- NUMBER_OF_SCOPES
+ NUMBER_OF_SCOPES,
+
+ FIRST_INCREMENTAL_SCOPE = MC_INCREMENTAL_WRAPPER_PROLOGUE,
+ LAST_INCREMENTAL_SCOPE = MC_INCREMENTAL_EXTERNAL_PROLOGUE,
+ NUMBER_OF_INCREMENTAL_SCOPES =
+ LAST_INCREMENTAL_SCOPE - FIRST_INCREMENTAL_SCOPE + 1
};
Scope(GCTracer* tracer, ScopeId scope);
@@ -197,7 +213,7 @@ class GCTracer {
// Size of new space objects in constructor.
intptr_t new_space_object_size;
- // Size of survived new space objects in desctructor.
+ // Size of survived new space objects in destructor.
intptr_t survived_new_space_object_size;
// Number of incremental marking steps since creation of tracer.
@@ -239,10 +255,35 @@ class GCTracer {
// events
double pure_incremental_marking_duration;
- // Longest incremental marking step since start of marking.
- // (value at start of event)
+ // 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];
};
@@ -365,6 +406,17 @@ class GCTracer {
// Discard all recorded survival events.
void ResetSurvivalEvents();
+ void AddScopeSample(Scope::ScopeId scope, double duration);
+
+ private:
+ FRIEND_TEST(GCTracer, AverageSpeed);
+ FRIEND_TEST(GCTracerTest, AllocationThroughput);
+ FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughput);
+ FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughputWithProvidedTime);
+ FRIEND_TEST(GCTracerTest, OldGenerationAllocationThroughputWithProvidedTime);
+ FRIEND_TEST(GCTracerTest, RegularScope);
+ FRIEND_TEST(GCTracerTest, IncrementalScope);
+
// Returns the average speed of the events in the buffer.
// If the buffer is empty, the result is 0.
// Otherwise, the result is between 1 byte/ms and 1 GB/ms.
@@ -374,7 +426,6 @@ class GCTracer {
void ResetForTesting();
- private:
// Print one detailed trace line in name=value format.
// TODO(ernstm): Move to Heap.
void PrintNVP() const;
@@ -455,6 +506,10 @@ class GCTracer {
// 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];
+
// Total sweeping time on the main thread.
// This timer is precise when run with --print-cumulative-gc-stat
// TODO(hpayer): Account for sweeping time on sweeper threads. Add a
« 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