Commit e32c5946 authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Add foreground/background UMA measurements for for main GC events.

Bug: chromium:814144
Change-Id: Idd729757608a714921254874af98a4a201340870
Reviewed-on: https://chromium-review.googlesource.com/981146Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52414}
parent 8aefac35
......@@ -1148,10 +1148,20 @@ class RuntimeCallTimerScope {
#define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \
HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND) \
HT(gc_compactor_background, V8.GCCompactorBackground, 10000, MILLISECOND) \
HT(gc_compactor_foreground, V8.GCCompactorForeground, 10000, MILLISECOND) \
HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND) \
HT(gc_finalize_background, V8.GCFinalizeMCBackground, 10000, MILLISECOND) \
HT(gc_finalize_foreground, V8.GCFinalizeMCForeground, 10000, MILLISECOND) \
HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000, \
MILLISECOND) \
HT(gc_finalize_reduce_memory_background, \
V8.GCFinalizeMCReduceMemoryBackground, 10000, MILLISECOND) \
HT(gc_finalize_reduce_memory_foreground, \
V8.GCFinalizeMCReduceMemoryForeground, 10000, MILLISECOND) \
HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND) \
HT(gc_scavenger_background, V8.GCScavengerBackground, 10000, MILLISECOND) \
HT(gc_scavenger_foreground, V8.GCScavengerForeground, 10000, MILLISECOND) \
HT(gc_context, V8.GCContext, 10000, \
MILLISECOND) /* GC context cleanup time */ \
HT(gc_idle_notification, V8.GCIdleNotification, 10000, MILLISECOND) \
......
......@@ -1087,6 +1087,33 @@ void Heap::FinalizeIncrementalMarking(GarbageCollectionReason gc_reason) {
}
}
HistogramTimer* Heap::GCTypePriorityTimer(GarbageCollector collector) {
if (IsYoungGenerationCollector(collector)) {
if (isolate_->IsIsolateInBackground()) {
return isolate_->counters()->gc_scavenger_background();
}
return isolate_->counters()->gc_scavenger_foreground();
} else {
if (!incremental_marking()->IsStopped()) {
if (ShouldReduceMemory()) {
if (isolate_->IsIsolateInBackground()) {
return isolate_->counters()->gc_finalize_reduce_memory_background();
}
return isolate_->counters()->gc_finalize_reduce_memory_foreground();
} else {
if (isolate_->IsIsolateInBackground()) {
return isolate_->counters()->gc_finalize_background();
}
return isolate_->counters()->gc_finalize_foreground();
}
} else {
if (isolate_->IsIsolateInBackground()) {
return isolate_->counters()->gc_compactor_background();
}
return isolate_->counters()->gc_compactor_foreground();
}
}
}
HistogramTimer* Heap::GCTypeTimer(GarbageCollector collector) {
if (IsYoungGenerationCollector(collector)) {
......@@ -1339,6 +1366,10 @@ bool Heap::CollectGarbage(AllocationSpace space,
HistogramTimerScope histogram_timer_scope(gc_type_timer);
TRACE_EVENT0("v8", gc_type_timer->name());
HistogramTimer* gc_type_priority_timer = GCTypePriorityTimer(collector);
HistogramTimerScope histogram_timer_priority_scope(
gc_type_priority_timer);
next_gc_likely_to_collect_more =
PerformGarbageCollection(collector, gc_callback_flags);
}
......
......@@ -1961,6 +1961,7 @@ class Heap {
// - GCFinalizeMCReduceMemory: finalization of incremental full GC with
// memory reduction
HistogramTimer* GCTypeTimer(GarbageCollector collector);
HistogramTimer* GCTypePriorityTimer(GarbageCollector collector);
// ===========================================================================
// Pretenuring. ==============================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment