[heap] Add UMA for overall marking time and marking throughput

Adds the following UMA counters:
- V8.GCMarkingSum: Overall time spent in marking per GC cycle
- V8.GCMainThreadMarkingThroughput: Overall marking throughput
  considering marking time spent on the main thread and
  allocated bytes after GC. Only reported if more than 1MB of
  live objects have been marked in the cycle.

Bug: chromium:945806
Change-Id: I24a37bf59f02da9aba984bed9de62fdb39be8882
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1547657
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60579}
This commit is contained in:
Michael Lippautz 2019-04-02 19:59:44 +02:00 committed by Commit Bot
parent 8f1c17067e
commit 0226bccaa2
2 changed files with 27 additions and 4 deletions

View File

@ -30,6 +30,10 @@ namespace internal {
HR(gc_scavenger_scavenge_main, V8.GCScavenger.ScavengeMain, 0, 10000, 101) \
HR(gc_scavenger_scavenge_roots, V8.GCScavenger.ScavengeRoots, 0, 10000, 101) \
HR(gc_mark_compactor, V8.GCMarkCompactor, 0, 10000, 101) \
HR(gc_marking_sum, V8.GCMarkingSum, 0, 10000, 101) \
/* Range and bucket matches BlinkGC.MainThreadMarkingThroughput. */ \
HR(gc_main_thread_marking_throughput, V8.GCMainThreadMarkingThroughput, 0, \
100000, 50) \
HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22) \
HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3) \
/* Asm/Wasm. */ \

View File

@ -266,10 +266,6 @@ void GCTracer::Start(GarbageCollector collector,
}
void GCTracer::ResetIncrementalMarkingCounters() {
if (incremental_marking_duration_ > 0) {
heap_->isolate()->counters()->incremental_marking_sum()->AddSample(
static_cast<int>(incremental_marking_duration_));
}
incremental_marking_bytes_ = 0;
incremental_marking_duration_ = 0;
for (int i = 0; i < Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) {
@ -1127,6 +1123,29 @@ void GCTracer::RecordGCPhasesHistograms(TimedHistogram* gc_timer) {
static_cast<int>(current_.scopes[Scope::MC_PROLOGUE]));
counters->gc_finalize_sweep()->AddSample(
static_cast<int>(current_.scopes[Scope::MC_SWEEP]));
if (incremental_marking_duration_ > 0) {
heap_->isolate()->counters()->incremental_marking_sum()->AddSample(
static_cast<int>(incremental_marking_duration_));
}
const double overall_marking_time =
incremental_marking_duration_ + current_.scopes[Scope::MC_MARK];
heap_->isolate()->counters()->gc_marking_sum()->AddSample(
static_cast<int>(overall_marking_time));
constexpr size_t kMinObjectSizeForReportingThroughput = 1024 * 1024;
if (base::TimeTicks::IsHighResolution() &&
heap_->SizeOfObjects() > kMinObjectSizeForReportingThroughput) {
DCHECK_GT(overall_marking_time, 0.0);
const int main_thread_marking_throughput_mb_per_s =
static_cast<int>(static_cast<double>(heap_->SizeOfObjects()) /
overall_marking_time * 1000 / 1024 / 1024);
heap_->isolate()
->counters()
->gc_main_thread_marking_throughput()
->AddSample(
static_cast<int>(main_thread_marking_throughput_mb_per_s));
}
DCHECK_EQ(Scope::LAST_TOP_MC_SCOPE, Scope::MC_SWEEP);
} else if (gc_timer == counters->gc_scavenger()) {
counters->gc_scavenger_scavenge_main()->AddSample(