Commit 2ebb83d9 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Fix an error in SlowerThread throughput reporting

Right now in FrameSequenceTracker::ReportMetrics, we compare the
throughput of the main thread vs the compositor thread, and report
the one with smaller throughput as the SlowerThread. There is an error
in the logic of determining which one is the slower thread. In
particular, currently we didn't consider the case where the compositor
and the main thread having the same throughput.

This CL fixes the error, and added a unit test.

Bug: None
Change-Id: Ib90b625665f508a8dab610a9ab07f90f6c4f1c58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838354
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703509}
parent 2b6665d4
...@@ -227,7 +227,7 @@ void FrameSequenceTracker::ReportMetrics() { ...@@ -227,7 +227,7 @@ void FrameSequenceTracker::ReportMetrics() {
base::Optional<ThroughputData> slower_throughput; base::Optional<ThroughputData> slower_throughput;
if (impl_throughput_percent && if (impl_throughput_percent &&
(!main_throughput_percent || (!main_throughput_percent ||
impl_throughput_percent.value() < main_throughput_percent.value())) { impl_throughput_percent.value() <= main_throughput_percent.value())) {
slower_throughput = impl_throughput_; slower_throughput = impl_throughput_;
} }
if (main_throughput_percent && if (main_throughput_percent &&
......
...@@ -149,6 +149,19 @@ class FrameSequenceTrackerTest : public testing::Test { ...@@ -149,6 +149,19 @@ class FrameSequenceTrackerTest : public testing::Test {
"Graphics.Smoothness.Throughput.MainThread.TouchScroll", 1u); "Graphics.Smoothness.Throughput.MainThread.TouchScroll", 1u);
histogram_tester.ExpectTotalCount( histogram_tester.ExpectTotalCount(
"Graphics.Smoothness.Throughput.SlowerThread.TouchScroll", 2u); "Graphics.Smoothness.Throughput.SlowerThread.TouchScroll", 2u);
// Test the case where compositor and main thread have the same throughput.
tracker_->impl_throughput_.frames_expected = 20u;
tracker_->impl_throughput_.frames_produced = 18u;
tracker_->main_throughput_.frames_expected = 20u;
tracker_->main_throughput_.frames_produced = 18u;
tracker_->ReportMetrics();
histogram_tester.ExpectTotalCount(
"Graphics.Smoothness.Throughput.CompositorThread.TouchScroll", 3u);
histogram_tester.ExpectTotalCount(
"Graphics.Smoothness.Throughput.MainThread.TouchScroll", 2u);
histogram_tester.ExpectTotalCount(
"Graphics.Smoothness.Throughput.SlowerThread.TouchScroll", 3u);
} }
protected: protected:
......
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