Index: test/unittests/heap/gc-tracer-unittest.cc |
diff --git a/test/unittests/heap/gc-tracer-unittest.cc b/test/unittests/heap/gc-tracer-unittest.cc |
index 97975d488bbfe5bb8720b080d1dc57289656630a..84e4d973e215709e9602ff9e193abaf7c773f082 100644 |
--- a/test/unittests/heap/gc-tracer-unittest.cc |
+++ b/test/unittests/heap/gc-tracer-unittest.cc |
@@ -183,5 +183,57 @@ TEST_F(GCTracerTest, IncrementalScope) { |
200.0, tracer->current_.scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]); |
} |
+TEST_F(GCTracerTest, IncrementalMarkingDetails) { |
+ GCTracer* tracer = i_isolate()->heap()->tracer(); |
+ tracer->ResetForTesting(); |
+ |
+ // Round 1. |
+ tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 50); |
+ tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); |
+ // Switch to incremental MC to enable writing back incremental scopes. |
+ tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; |
+ tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100); |
+ tracer->Stop(MARK_COMPACTOR); |
+ EXPECT_DOUBLE_EQ( |
+ 100, |
+ tracer->current_ |
+ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] |
+ .longest_step); |
+ EXPECT_EQ( |
+ 2, |
+ tracer->current_ |
+ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] |
+ .steps); |
+ EXPECT_DOUBLE_EQ( |
+ 150, |
+ tracer->current_ |
+ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] |
+ .cumulative_duration); |
+ |
+ // Round 2. Cumulative numbers should add up, others should be reset. |
+ tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 13); |
+ tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 15); |
+ tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); |
+ // Switch to incremental MC to enable writing back incremental scopes. |
+ tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; |
+ tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 122); |
+ tracer->Stop(MARK_COMPACTOR); |
+ EXPECT_DOUBLE_EQ( |
+ 122, |
+ tracer->current_ |
+ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] |
+ .longest_step); |
+ EXPECT_EQ( |
+ 3, |
+ tracer->current_ |
+ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] |
+ .steps); |
+ EXPECT_DOUBLE_EQ( |
+ 300, |
+ tracer->current_ |
+ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] |
+ .cumulative_duration); |
+} |
+ |
} // namespace internal |
} // namespace v8 |