Reland "[heap] Add marking summary counter"

Fix: Guard with lock when accessing background counters.

This reverts commit d5f3e22577.

CQ_INCLUDE_TRYBOTS=luci.v8.try:v8_linux64_tsan_rel

Change-Id: I4e00f41ce6a2fac86d4e90c70e57c7a333442a97
Reviewed-on: https://chromium-review.googlesource.com/c/1301503
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57027}
This commit is contained in:
Michael Lippautz 2018-10-26 12:53:57 +02:00 committed by Commit Bot
parent 02d1e6c8eb
commit 36f1bafc7c

View File

@ -1124,7 +1124,8 @@ void GCTracer::RecordGCPhasesHistograms(HistogramTimer* gc_timer) {
}
void GCTracer::RecordGCSumCounters(double atomic_pause_duration) {
// Emit UMA counters.
base::MutexGuard guard(&background_counter_mutex_);
const double overall_duration =
current_.incremental_marking_scopes[Scope::MC_INCREMENTAL_START]
.duration +
@ -1134,13 +1135,41 @@ void GCTracer::RecordGCSumCounters(double atomic_pause_duration) {
current_.incremental_marking_scopes[Scope::MC_INCREMENTAL_FINALIZE]
.duration +
atomic_pause_duration;
const double background_duration =
background_counter_[BackgroundScope::MC_BACKGROUND_EVACUATE_COPY]
.total_duration_ms +
background_counter_
[BackgroundScope::MC_BACKGROUND_EVACUATE_UPDATE_POINTERS]
.total_duration_ms +
background_counter_[BackgroundScope::MC_BACKGROUND_MARKING]
.total_duration_ms +
background_counter_[BackgroundScope::MC_BACKGROUND_SWEEPING]
.total_duration_ms;
const double marking_duration =
current_.incremental_marking_scopes[Scope::MC_INCREMENTAL_START]
.duration +
incremental_marking_duration_ +
current_.incremental_marking_scopes[Scope::MC_INCREMENTAL_FINALIZE]
.duration +
current_.scopes[Scope::MC_MARK];
const double marking_background_duration =
background_counter_[BackgroundScope::MC_BACKGROUND_MARKING]
.total_duration_ms;
// UMA.
heap_->isolate()->counters()->gc_mark_compactor()->AddSample(
static_cast<int>(overall_duration));
// Emit trace event counters.
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
"V8.GCMarkCompactorSummary", TRACE_EVENT_SCOPE_THREAD,
"duration", overall_duration);
"duration", overall_duration, "background_duration",
background_duration);
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
"V8.GCMarkCompactorMarkingSummary",
TRACE_EVENT_SCOPE_THREAD, "duration", marking_duration,
"background_duration", marking_background_duration);
}
} // namespace internal