heap: Fix marking speed computation

The marking speed is computed from incremental marking steps reported.
In case of embedder tracing, such steps should not include time spent
processing embedder memory.

Bug: chromium:1044630, chromium:1049084
Change-Id: Ie7b5af569b4114dd8dffd2d85eaf28ece9dfa18c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2062394
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66316}
This commit is contained in:
Michael Lippautz 2020-02-18 19:11:01 +01:00 committed by Commit Bot
parent 545f820c28
commit 5c612398e5

View File

@ -1128,13 +1128,12 @@ StepResult IncrementalMarking::Step(double max_step_size_in_ms,
heap_->concurrent_marking()->RescheduleTasksIfNeeded(); heap_->concurrent_marking()->RescheduleTasksIfNeeded();
} }
} }
double duration = (heap_->MonotonicallyIncreasingTimeInMs() - start);
if (state_ == MARKING) { if (state_ == MARKING) {
// Note that we report zero bytes here when sweeping was in progress or // Note that we do not report any marked by in case of finishing sweeping as
// when we just started incremental marking. In these cases we did not // we did not process the marking worklist.
// process the marking deque. const double v8_duration =
heap_->tracer()->AddIncrementalMarkingStep(duration, v8_bytes_processed); heap_->MonotonicallyIncreasingTimeInMs() - start - embedder_duration;
heap_->tracer()->AddIncrementalMarkingStep(v8_duration, v8_bytes_processed);
} }
if (FLAG_trace_incremental_marking) { if (FLAG_trace_incremental_marking) {
heap_->isolate()->PrintWithTimestamp( heap_->isolate()->PrintWithTimestamp(
@ -1142,7 +1141,7 @@ StepResult IncrementalMarking::Step(double max_step_size_in_ms,
"in %.1f\n", "in %.1f\n",
step_origin == StepOrigin::kV8 ? "in v8" : "in task", step_origin == StepOrigin::kV8 ? "in v8" : "in task",
v8_bytes_processed / KB, bytes_to_process / KB, embedder_duration, v8_bytes_processed / KB, bytes_to_process / KB, embedder_duration,
embedder_deadline, duration); embedder_deadline, heap_->MonotonicallyIncreasingTimeInMs() - start);
} }
return combined_result; return combined_result;
} }