Commit 67bd78cc authored by Mikhail Khokhlov's avatar Mikhail Khokhlov Committed by Commit Bot

[tools/perf] Remove obsolete jank metrics

We have collected enough data to choose the most relevant metric.
All other jank metrics can be removed.

Bug: b/151081375
Change-Id: I5e331294297de1fb69e4862ac088842368b4d717
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128488Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Commit-Queue: Mikhail Khokhlov <khokhlov@google.com>
Cr-Commit-Position: refs/heads/master@{#754906}
parent 4790005f
...@@ -28,8 +28,6 @@ class SystemHealthInfiniteScroll(system_health.MobileCommonSystemHealth): ...@@ -28,8 +28,6 @@ class SystemHealthInfiniteScroll(system_health.MobileCommonSystemHealth):
self).CreateCoreTimelineBasedMeasurementOptions() self).CreateCoreTimelineBasedMeasurementOptions()
options.ExtendTraceCategoryFilter(['benchmark', 'cc', 'input']) options.ExtendTraceCategoryFilter(['benchmark', 'cc', 'input'])
options.SetTimelineBasedMetrics([ options.SetTimelineBasedMetrics([
'tbmv3:scroll_jank_metric',
'tbmv3:janky_scroll_periods',
'tbmv3:janky_time_per_scroll_processing_time', 'tbmv3:janky_time_per_scroll_processing_time',
]) ])
return options return options
......
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
syntax = "proto2";
package perfetto.protos;
import "protos/perfetto/metrics/metrics.proto";
import "protos/perfetto/metrics/custom_options.proto";
// A metric that counts the number of janky scroll gestures and the number
// of periods of continuous jankiness.
// Required category: latencyInfo
message JankyScrollPeriods {
optional int64 num_gestures = 1 [(unit) = "count_smallerIsBetter"];
optional int64 num_periods = 2 [(unit) = "count_smallerIsBetter"];
}
extend TraceMetrics {
optional JankyScrollPeriods janky_scroll_periods = 453;
}
-- Copyright 2020 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
-- A metric that counts the number of janky scroll periods. A janky scroll period
-- is defined as a time period during which:
-- (i) Chrome was handling GuestureScrollUpdate input events, and
-- (ii) sequential GuestureScrollUpdate events had a duration that differed
-- by more than half a frame.
-- The metric assumes a frame rate of 60fps.
--
-- Note that there's a similar metric in scroll_jank_metric.sql that uses
-- a slightly different approach to estimate jankiness. Keeping two metrics
-- around is a temporary measure for experimental purposes. In the end we want
-- to leave only one of them.
-- TODO(khokhlov): Remove one of these metrics.
-- Get the GestureScrollUpdate events by name ordered by timestamp, compute
-- the number of frames (relative to 60 fps) that each event took. 1.6e+7 is
-- 16 ms in nanoseconds.
CREATE VIEW GestureScrollUpdates AS
SELECT
ROW_NUMBER() OVER (ORDER BY ts ASC) AS rowNumber,
id AS ScrollId,
ts AS ScrollTs,
arg_set_id AS ScrollArgSetId,
dur AS ScrollDur,
dur/1.6e+7 AS ScrollFramesExact,
CAST(dur/1.6e+7 AS int) AS ScrollFramesRounded
FROM
slice
WHERE
name = 'InputLatency::GestureScrollUpdate'
ORDER BY ScrollTs;
-- This takes the GestureScrollUpdate and joins it to the previous row (NULL
-- if there isn't one) and the next row (NULL if there isn't one). And then
-- computes whether the duration of the event (relative to 60 fps) varied by
-- more than 0.5 (which is 1/2 of 16 ms).
CREATE VIEW ScrollJanksComplete AS
SELECT
ROW_NUMBER() OVER (ORDER BY currTs ASC) AS rowNumber,
currScrollId,
currTs,
currScrollFramesExact,
currScrollFramesExact
NOT BETWEEN
prevScrollFramesExact - 0.5 AND
prevScrollFramesExact + 0.5
AS prevJank,
currScrollFramesExact
NOT BETWEEN
next.ScrollFramesExact - 0.5 AND
next.ScrollFramesExact + 0.5
AS nextJank,
(
currScrollFramesExact
NOT BETWEEN
prevScrollFramesExact - 0.5 AND
prevScrollFramesExact + 0.5
) AND (
currScrollFramesExact
NOT BETWEEN
next.ScrollFramesExact - 0.5 AND
next.ScrollFramesExact + 0.5
) AS bothJank
FROM (
SELECT
curr.rowNumber AS currRowNumber,
curr.Scrollts AS currTs,
curr.ScrollId AS currScrollId,
curr.ScrollFramesExact AS currScrollFramesExact,
prev.ScrollFramesExact AS prevScrollFramesExact
FROM
GestureScrollUpdates curr LEFT JOIN
GestureScrollUpdates prev ON prev.rowNumber + 1 = curr.rowNumber
) currprev JOIN
GestureScrollUpdates next ON currprev.currRowNumber + 1 = next.rowNumber
ORDER BY currprev.currTs ASC;
-- This just lists outs the rowNumber (which is ordered by timestamp) and
-- whether it was a janky slice (as defined by comparing to both the next and
-- previous slice).
CREATE VIEW ScrollJanks AS
SELECT
rowNumber,
bothJank OR
(nextJank AND prevJank IS NULL) OR
(prevJank AND nextJank IS NULL)
AS Jank
FROM ScrollJanksComplete;
-- This sums the number of periods with sequential janky slices. When Chrome
-- experiences a jank it often stumbles for a while, this attempts to
-- encapsulate this by only counting thestumbles and not all the janky
-- individual slices.
CREATE VIEW JankyScrollPeriodsView AS
SELECT
SUM(CASE WHEN curr.Jank = 1 THEN 1 ELSE 0 END) as gestures,
SUM(CASE WHEN curr.Jank = 1 AND (prev.Jank IS NULL OR prev.Jank = 0)
THEN 1 ELSE 0 END) AS periods
FROM (
SELECT * from ScrollJanks
) curr LEFT JOIN (
SELECT * from ScrollJanks
) prev ON curr.rowNumber = prev.rowNumber + 1;
-- Output the proto with metric values.
CREATE VIEW janky_scroll_periods_output AS
SELECT JankyScrollPeriods(
'num_gestures', COALESCE(gestures, 0),
'num_periods', COALESCE(periods, 0))
FROM JankyScrollPeriodsView;
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
syntax = "proto2";
package perfetto.protos;
import "protos/perfetto/metrics/metrics.proto";
import "protos/perfetto/metrics/custom_options.proto";
// The metric finds periods in a trace when scroll update events started
// but didn't finish. The idea is that it's perceived by the user as a scroll
// delay, i.e. jank.
// requiredCategories = ["latencyInfo"]. Will be a message option field once
// tooling exists.
message ScrollJankMetric {
optional int64 num_janks = 1 [(unit) = "count_smallerIsBetter"];
optional int64 num_big_janks = 2 [(unit) = "count_smallerIsBetter"];
optional float total_jank_duration = 3 [(unit) = "ms_smallerIsBetter"];
}
extend TraceMetrics {
optional ScrollJankMetric scroll_jank_metric = 452;
}
-- Copyright 2020 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
-- The metric finds periods in a trace when scroll update events started
-- but didn't finish. The idea is that it's perceived by the user as a scroll
-- delay, i.e. jank.
-- Note that there's a similar metric in janky_scroll_periods.sql that uses
-- a slightly different approach to estimate jankiness. Keeping two metrics
-- around is a temporary measure for experimental purposes. In the end we want
-- to leave only one of them.
-- TODO(khokhlov): Remove one of these metrics.
-- This selects GestureScrollUpdate events.
CREATE VIEW input_latency_events AS
SELECT
ts AS start, ts + dur AS finish
FROM slice
WHERE
name = "InputLatency::GestureScrollUpdate";
-- Every row of this query is a span from one event finish to the next.
-- Column names 'ts' and 'dur' are as expected by SPAN_JOIN function.
CREATE VIEW intervals_between_finishes AS
SELECT
finish AS ts,
LEAD(finish) OVER (ORDER BY finish) AS next_ts,
LEAD(finish) OVER (ORDER BY finish) - finish AS dur
FROM input_latency_events;
-- Every row of this query marks the start of some GestureScrollUpdate event.
-- Column names 'ts' and 'dur' are as expected by SPAN_JOIN function.
CREATE VIEW start_moments AS
SELECT start AS ts, 0 AS dur
FROM input_latency_events
ORDER BY ts;
-- This span-joins the two views and yields a table where every start moment
-- is joined with the corresponding span between finishes.
CREATE VIRTUAL TABLE starts_joined
USING SPAN_JOIN(intervals_between_finishes, start_moments);
-- Now we can count how many starts there were between every two finishes
-- and how long it took from the earliest start to the finish.
CREATE VIEW janks AS
SELECT next_ts - MIN(ts) AS dur, COUNT(*) AS n_starts
FROM starts_joined
GROUP BY next_ts;
-- We can use different thresholds for calling interval a jank.
-- Here we set two thresholds of 17ms and 34ms, that correspond to the duration
-- of 1 and 2 frames at 60 fps, rounded up.
-- TODO(khokhlov): Investigate how this metric handles breaks between scrolls
-- and dropped frames.
CREATE VIEW scroll_jank_metric AS
SELECT
(SELECT COUNT(*) FROM janks WHERE dur > 17e6 AND n_starts > 1) AS num_janks,
(SELECT COUNT(*) FROM janks WHERE dur > 34e6 AND n_starts > 1) AS num_big_janks,
(SELECT COALESCE(SUM(dur) / 1e6, 0) FROM janks WHERE dur > 17e6 AND n_starts > 1) AS total_jank_duration;
-- Output the proto with metric values.
CREATE VIEW scroll_jank_metric_output AS
SELECT ScrollJankMetric(
'num_janks', num_janks,
'num_big_janks', num_big_janks,
'total_jank_duration', total_jank_duration)
FROM scroll_jank_metric;
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