• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2022 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--
16-- WARNING: This metric should not be used as a source of truth. It is under
17--          active development and the values & meaning might change without
18--          notice.
19
20SELECT RUN_METRIC(
21  'chrome/chrome_long_tasks.sql'
22);
23
24-- Input tasks/flows are recorded almost the same way as they are in top-level
25-- slices, however the input task will not necessarily be a parent of the
26-- latencyInfo slice. As such, we can utilize much of the existing input to
27-- browser interval base calculations. Determining whether an input is a fling
28-- or other blocked input will need to be calculated differently, below.
29SELECT RUN_METRIC(
30  'chrome/chrome_input_to_browser_intervals_base.sql',
31  'slice_table_name', 'slice',
32  'function_prefix', ''
33);
34
35-- Needed for calculating chrome input to browser intervals.
36-- Input IPCs are not necessarily always long tasks, hence a new slice name.
37DROP TABLE IF EXISTS chrome_input_to_browser_intervals_long_tasks;
38CREATE TABLE chrome_input_to_browser_intervals_long_tasks
39AS
40SELECT
41  (SELECT ts FROM slice WHERE id = window_start_id) AS window_start_ts,
42  window_start_id,
43  window_end_ts,
44  window_end_id,
45  blocked_gesture,
46  cis.upid,
47  GET_SCROLL_TYPE(blocked_gesture, lts.interface_name) AS scroll_type
48FROM chrome_input_to_browser_interval_slice_ids cis
49LEFT JOIN (
50  SELECT
51    m.interface_name,
52    m.id,
53    upid,
54    s.ts,
55    s.dur
56  FROM
57    SELECT_LONG_TASK_SLICES('InterestingTask_ProcessingTime') m
58    JOIN slice s USING(id)
59    JOIN thread_track tt ON s.track_id = tt.id JOIN thread USING (utid)
60) lts
61ON cis.upid = lts.upid
62  AND (cis.window_end_ts > lts.ts AND cis.window_end_ts <= lts.ts + dur);
63
64-- Calculating chrome tasks delaying input will be the same, just using the
65-- long-task based tables instead of chrome_tasks.
66SELECT RUN_METRIC(
67  'chrome/chrome_tasks_delaying_input_processing_base.sql',
68  'duration_causing_jank_ms', '4',
69  'task_table_name', 'chrome_long_tasks',
70  'input_browser_interval_table_name', 'chrome_input_to_browser_intervals_long_tasks',
71  'function_prefix', ''
72);