• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2020 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-- Needed for the scroll_jank table to tell which updates were janky.
17SELECT RUN_METRIC('chrome/scroll_jank.sql');
18
19-- Causes of jank which we will join together. The process to add new causes
20-- should be pretty straight forward.
21--
22-- 1) Determine a query (or sequence of queries) which identifies a
23--    InputLatency::GestureScrollUpdate (which can be found in the scroll_jank
24--    table) that was effected by the cause you are investigating.
25-- 2) output the InputLatency::GestureScrollUpdate id from the slice table (or
26--    scroll_jank table), along with a "true" ish value if that
27--    InputLatency::GestureScrollUpdate was affected by your cause
28-- 3) Add your new metric file in the SELECT RUN_METRIC lines below.
29-- 4) Add a LEFT JOIN on your output table joining on the
30--    InputLatency::GestureScrollUpdate id with scroll_jank_cause_joined.
31-- 5) modify the scroll_jank_cause_explained_jank to include your cause.
32SELECT RUN_METRIC('chrome/scroll_jank_cause_blocking_touch_move.sql');
33SELECT RUN_METRIC('chrome/scroll_jank_cause_blocking_task.sql');
34SELECT RUN_METRIC('chrome/scroll_jank_cause_get_bitmap.sql');
35
36DROP VIEW IF EXISTS scroll_jank_cause_joined;
37CREATE VIEW scroll_jank_cause_joined AS
38SELECT
39  COALESCE(move.blocking_touch_move, 0) AS blocking_touch_move,
40  COALESCE(task.blocked_by_language_detection, 0)
41  AS blocked_by_language_detection,
42  COALESCE(task.blocked_by_copy_request, 0) AS blocked_by_copy_request,
43  COALESCE(bitmap.blocked_by_bitmap, 0) AS blocked_by_bitmap,
44  COALESCE(bitmap.blocked_by_toolbar, 0) AS blocked_by_toolbar,
45  COALESCE(bitmap.blocked_by_bitmap_no_toolbar, 0)
46  AS blocked_by_bitmap_no_toolbar,
47  jank.*
48FROM
49  scroll_jank jank LEFT JOIN
50  scroll_jank_cause_blocking_touch_move move
51  ON jank.id = move.scroll_id LEFT JOIN
52  scroll_jank_cause_blocking_task task
53  ON jank.id = task.scroll_id LEFT JOIN
54  scroll_jank_cause_get_bitmap bitmap
55  ON jank.id = bitmap.scroll_id;
56
57DROP VIEW IF EXISTS scroll_jank_cause_explained_jank;
58CREATE VIEW scroll_jank_cause_explained_jank AS
59SELECT
60  CASE WHEN
61      NOT jank
62      THEN
63      FALSE
64    ELSE
65      COALESCE(blocking_touch_move
66        OR blocked_by_language_detection
67        OR blocked_by_copy_request
68        OR blocked_by_bitmap, FALSE)
69  END AS explained_jank,
70  jank.*
71FROM scroll_jank_cause_joined jank;
72
73DROP VIEW IF EXISTS scroll_jank_cause;
74CREATE VIEW scroll_jank_cause AS
75SELECT
76  jank AND NOT explained_jank AS unexplained_jank,
77  jank.*
78FROM scroll_jank_cause_explained_jank jank;
79