• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2023 The Android Open Source Project
3--
4-- Licensed under the Apache License, Version 2.0 (the "License");
5-- you may not use this file except in compliance with the License.
6-- You may obtain a copy of the License at
7--
8--     https://www.apache.org/licenses/LICENSE-2.0
9--
10-- Unless required by applicable law or agreed to in writing, software
11-- distributed under the License is distributed on an "AS IS" BASIS,
12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-- See the License for the specific language governing permissions and
14-- limitations under the License.
15
16INCLUDE PERFETTO MODULE chrome.scroll_jank.scroll_jank_v3;
17
18DROP VIEW IF EXISTS chrome_scroll_jank_v3_intermediate;
19
20-- An "intermediate" view for computing `chrome_scroll_jank_v3_output` below.
21--
22-- @column trace_num_frames          The number of frames in the trace.
23-- @column trace_num_janky_frames    The number of delayed/janky frames in the
24--                                   trace.
25-- @column vsync_interval            The standard vsync interval.
26-- @column scrolls                   A proto amalgamation of metrics per scroll
27--                                   including the number of frames, number of
28--                                   janky frames, percent of janky frames,
29--                                   maximum presentation delay, and the causes
30--                                   of jank (cause, sub-cause, delay).
31CREATE PERFETTO VIEW chrome_scroll_jank_v3_intermediate AS
32SELECT
33  -- MAX does not matter for these aggregations, since the values are the
34  -- same across rows.
35  (SELECT COUNT(*) FROM chrome_frame_info_with_delay)
36    AS trace_num_frames,
37  (SELECT COUNT(*) FROM chrome_janky_frames)
38    AS trace_num_janky_frames,
39  causes.vsync_interval,
40  RepeatedField(
41    ChromeScrollJankV3_Scroll(
42      'num_frames',
43      frames.num_frames,
44      'num_janky_frames',
45      frames.num_janky_frames,
46      'scroll_jank_percentage',
47      frames.scroll_jank_percentage,
48      'max_delay_since_last_frame',
49      causes.max_delay_since_last_frame,
50      'scroll_jank_causes',
51      causes.scroll_jank_causes))
52    AS scrolls
53FROM
54  chrome_frames_per_scroll AS frames
55INNER JOIN chrome_causes_per_scroll AS causes
56  ON frames.scroll_id = causes.scroll_id;
57
58DROP VIEW IF EXISTS chrome_scroll_jank_v3_output;
59
60-- For producing a "native" Perfetto UI metric.
61--
62-- @column scroll_jank_summary     A proto amalgamation summarizing all of the
63--                                 scroll jank in a trace, including the number
64--                                 of frames, janky frames, percentage of janky
65--                                 frames, vsync interval, and a summary of this
66--                                 data (including individual causes) for each
67--                                 scroll.
68CREATE PERFETTO VIEW chrome_scroll_jank_v3_output AS
69SELECT
70  ChromeScrollJankV3(
71    'trace_num_frames',
72    trace_num_frames,
73    'trace_num_janky_frames',
74    trace_num_janky_frames,
75    'trace_scroll_jank_percentage',
76    100.0 * trace_num_janky_frames / trace_num_frames,
77    'vsync_interval_ms',
78    vsync_interval,
79    'scrolls',
80    scrolls) AS scroll_jank_summary
81FROM
82  chrome_scroll_jank_v3_intermediate;
83