Commit 944343bf authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[throughput] Fix FrameSequenceLength.Video reporting

We are seeing half of FrameSequenceLength.Video reports length 0.
What's the problem? It turns out that those half are from the main
thread. A video frame is on impl thread only, so main thread gets
0 frames for a video tracker.

This CL fixes it.

Bug: 1112893
Change-Id: I0f6b41625ac2d781dc9c0599e0e8ad28c06a033d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2342247Reviewed-by: default avatarBehdad Bakhshinategh <behdadb@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795949}
parent 9d0c2176
......@@ -313,6 +313,11 @@ base::Optional<int> FrameSequenceMetrics::ThroughputData::ReportHistogram(
const auto sequence_type = metrics->type();
DCHECK_LT(sequence_type, FrameSequenceTrackerType::kMaxType);
// All video frames are compositor thread only.
if (sequence_type == FrameSequenceTrackerType::kVideo &&
thread_type == ThreadType::kMain)
return base::nullopt;
STATIC_HISTOGRAM_POINTER_GROUP(
GetFrameSequenceLengthHistogramName(sequence_type),
static_cast<int>(sequence_type),
......
......@@ -87,6 +87,19 @@ TEST(FrameSequenceMetricsTest, ScrollingThreadMergeMetrics) {
}
#endif // DCHECK_IS_ON()
TEST(FrameSequenceMetricsTest, VideoReportsOnImplOnly) {
base::HistogramTester histograms;
FrameSequenceMetrics first(FrameSequenceTrackerType::kVideo, nullptr);
first.impl_throughput().frames_expected = 120;
first.impl_throughput().frames_produced = 80;
first.main_throughput().frames_expected = 0;
first.main_throughput().frames_produced = 0;
first.ReportMetrics();
histograms.ExpectTotalCount("Graphics.Smoothness.FrameSequenceLength.Video",
1u);
}
TEST(FrameSequenceMetricsTest, AllMetricsReported) {
base::HistogramTester histograms;
......
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