Commit 12776afc authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

heap: Fix metric around corner case of fast marking

Bug: v8:10956
Change-Id: Iab17e3f0163aa81cfb978d72e0f0cd9b15c14743
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2454716Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70371}
parent f3a666d6
......@@ -1229,14 +1229,18 @@ void GCTracer::RecordGCPhasesHistograms(TimedHistogram* gc_timer) {
heap_->isolate()->counters()->gc_marking_sum()->AddSample(
static_cast<int>(overall_marking_time));
// Filter out samples where
// - we don't have high-resolution timers;
// - size of marked objects is very small;
// - marking time is rounded to 0;
constexpr size_t kMinObjectSizeForReportingThroughput = 1024 * 1024;
if (base::TimeTicks::IsHighResolution() &&
heap_->SizeOfObjects() > kMinObjectSizeForReportingThroughput) {
DCHECK_GT(overall_marking_time, 0.0);
heap_->SizeOfObjects() > kMinObjectSizeForReportingThroughput &&
overall_marking_time > 0) {
const double overall_v8_marking_time =
overall_marking_time -
current_.scopes[Scope::MC_MARK_EMBEDDER_TRACING];
DCHECK_GT(overall_v8_marking_time, 0.0);
if (overall_v8_marking_time > 0) {
const int main_thread_marking_throughput_mb_per_s =
static_cast<int>(static_cast<double>(heap_->SizeOfObjects()) /
overall_v8_marking_time * 1000 / 1024 / 1024);
......@@ -1246,6 +1250,7 @@ void GCTracer::RecordGCPhasesHistograms(TimedHistogram* gc_timer) {
->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()) {
......
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