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 38 SELECT 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.* 48 FROM 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 59 SELECT 60 CASE WHEN 61 NOT jank 62 THEN 63 FALSE 64 ELSE 65 CASE WHEN 66 blocking_touch_move OR 67 blocked_by_language_detection OR 68 blocked_by_copy_request OR 69 blocked_by_bitmap 70 THEN 71 TRUE 72 ELSE 73 FALSE 74 END 75 END AS explained_jank, 76 jank.* 77 FROM scroll_jank_cause_joined jank; 78 79DROP VIEW IF EXISTS scroll_jank_cause; 80CREATE VIEW scroll_jank_cause AS 81 SELECT 82 jank AND NOT explained_jank AS unexplained_jank, 83 jank.* 84 FROM scroll_jank_cause_explained_jank jank; 85