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

Side by Side Diff: test/unittests/heap/gc-tracer-unittest.cc

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, 3 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 unified diff | Download patch
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 #include "src/heap/gc-tracer.h" 9 #include "src/heap/gc-tracer.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100); 176 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100);
177 tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); 177 tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest");
178 // Switch to incremental MC to enable writing back incremental scopes. 178 // Switch to incremental MC to enable writing back incremental scopes.
179 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; 179 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR;
180 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100); 180 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100);
181 tracer->Stop(MARK_COMPACTOR); 181 tracer->Stop(MARK_COMPACTOR);
182 EXPECT_DOUBLE_EQ( 182 EXPECT_DOUBLE_EQ(
183 200.0, tracer->current_.scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]); 183 200.0, tracer->current_.scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]);
184 } 184 }
185 185
186 TEST_F(GCTracerTest, IncrementalMarkingDetails) {
187 GCTracer* tracer = i_isolate()->heap()->tracer();
188 tracer->ResetForTesting();
189
190 // Round 1.
191 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 50);
192 tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest");
193 // Switch to incremental MC to enable writing back incremental scopes.
194 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR;
195 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100);
196 tracer->Stop(MARK_COMPACTOR);
197 EXPECT_DOUBLE_EQ(
198 100,
199 tracer->current_
200 .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]
201 .longest_step);
202 EXPECT_EQ(
203 2,
204 tracer->current_
205 .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]
206 .steps);
207 EXPECT_DOUBLE_EQ(
208 150,
209 tracer->current_
210 .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]
211 .cumulative_duration);
212
213 // Round 2. Cumulative numbers should add up, others should be reset.
214 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 13);
215 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 15);
216 tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest");
217 // Switch to incremental MC to enable writing back incremental scopes.
218 tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR;
219 tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 122);
220 tracer->Stop(MARK_COMPACTOR);
221 EXPECT_DOUBLE_EQ(
222 122,
223 tracer->current_
224 .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]
225 .longest_step);
226 EXPECT_EQ(
227 3,
228 tracer->current_
229 .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]
230 .steps);
231 EXPECT_DOUBLE_EQ(
232 300,
233 tracer->current_
234 .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]
235 .cumulative_duration);
236 }
237
186 } // namespace internal 238 } // namespace internal
187 } // namespace v8 239 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698