Replace RAF with JSAnimation in AllAnimations metrics
This CL uses the more inclusive JSAnimation metrics in AllAnimations and AllSequences metrics to replace RAF metrics, allowing the capturing of a wider range of animation metrics without double counting. Bug: 1215636 Change-Id: Icdf2d11dbc11bc18363a743832a57ef4550561bf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3107609 Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org> Reviewed-by: Xida Chen <xidachen@chromium.org> Commit-Queue: Mingjing Zhang <mjzhang@chromium.org> Cr-Commit-Position: refs/heads/main@{#914857}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
19d16a4bc9
commit
3f93b447fe
@ -25,7 +25,7 @@ bool ShouldReportForAnimation(FrameSequenceTrackerType sequence_type,
|
||||
return thread_type == FrameSequenceMetrics::ThreadType::kCompositor;
|
||||
|
||||
if (sequence_type == FrameSequenceTrackerType::kMainThreadAnimation ||
|
||||
sequence_type == FrameSequenceTrackerType::kRAF)
|
||||
sequence_type == FrameSequenceTrackerType::kJSAnimation)
|
||||
return thread_type == FrameSequenceMetrics::ThreadType::kMain;
|
||||
|
||||
return false;
|
||||
@ -253,8 +253,7 @@ void FrameSequenceMetrics::ReportMetrics() {
|
||||
type_),
|
||||
impl_throughput_);
|
||||
}
|
||||
if (main_report || type_ == FrameSequenceTrackerType::kCanvasAnimation ||
|
||||
type_ == FrameSequenceTrackerType::kJSAnimation) {
|
||||
if (main_report) {
|
||||
main_throughput_percent_dropped =
|
||||
ThroughputData::ReportDroppedFramePercentHistogram(
|
||||
this, ThreadType::kMain,
|
||||
@ -405,6 +404,12 @@ bool FrameSequenceMetrics::ThroughputData::CanReportHistogram(
|
||||
thread_type == ThreadType::kMain)
|
||||
return false;
|
||||
|
||||
// RAF and CanvasAnimation are main thread only.
|
||||
if ((sequence_type == FrameSequenceTrackerType::kRAF ||
|
||||
sequence_type == FrameSequenceTrackerType::kCanvasAnimation) &&
|
||||
thread_type == ThreadType::kCompositor)
|
||||
return false;
|
||||
|
||||
if (data.frames_expected < kMinFramesForThroughputMetric)
|
||||
return false;
|
||||
|
||||
@ -412,7 +417,9 @@ bool FrameSequenceMetrics::ThroughputData::CanReportHistogram(
|
||||
ShouldReportForAnimation(sequence_type, thread_type);
|
||||
|
||||
return is_animation || IsInteractionType(sequence_type) ||
|
||||
sequence_type == FrameSequenceTrackerType::kVideo;
|
||||
sequence_type == FrameSequenceTrackerType::kVideo ||
|
||||
sequence_type == FrameSequenceTrackerType::kRAF ||
|
||||
sequence_type == FrameSequenceTrackerType::kCanvasAnimation;
|
||||
}
|
||||
|
||||
int FrameSequenceMetrics::ThroughputData::ReportDroppedFramePercentHistogram(
|
||||
@ -422,9 +429,7 @@ int FrameSequenceMetrics::ThroughputData::ReportDroppedFramePercentHistogram(
|
||||
const ThroughputData& data) {
|
||||
const auto sequence_type = metrics->type();
|
||||
DCHECK_LT(sequence_type, FrameSequenceTrackerType::kMaxType);
|
||||
DCHECK(CanReportHistogram(metrics, thread_type, data) ||
|
||||
sequence_type == FrameSequenceTrackerType::kCanvasAnimation ||
|
||||
sequence_type == FrameSequenceTrackerType::kJSAnimation);
|
||||
DCHECK(CanReportHistogram(metrics, thread_type, data));
|
||||
|
||||
// Throughput means the percent of frames that was expected to show on the
|
||||
// screen but didn't. In other words, the lower the throughput is, the
|
||||
|
@ -503,14 +503,9 @@ TEST_F(JankMetricsTest, RAFMergeJanks) {
|
||||
histogram_tester.ExpectTotalCount(invalid_metric, 0u);
|
||||
|
||||
// Test all-sequence metrics.
|
||||
histogram_tester.ExpectTotalCount(kAllSequencesMetricName, 1u);
|
||||
EXPECT_THAT(histogram_tester.GetAllSamples(kAllSequencesMetricName),
|
||||
testing::ElementsAre(base::Bucket(6, 1)));
|
||||
|
||||
histogram_tester.ExpectTotalCount(kAllAnimationsMetricName, 1u);
|
||||
EXPECT_THAT(histogram_tester.GetAllSamples(kAllAnimationsMetricName),
|
||||
testing::ElementsAre(base::Bucket(6, 1)));
|
||||
|
||||
// RAF is not included in AllSequences/AllAnimations metrics.
|
||||
histogram_tester.ExpectTotalCount(kAllSequencesMetricName, 0u);
|
||||
histogram_tester.ExpectTotalCount(kAllAnimationsMetricName, 0u);
|
||||
histogram_tester.ExpectTotalCount(kAllInteractionsMetricName, 0u);
|
||||
|
||||
// Stale-frame metrics
|
||||
|
Reference in New Issue
Block a user