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-- A collection of metrics related to janky scrolling. Please refer to the 17-- corresponding `chrome/scroll_jank_v2.proto` for more details. 18 19SELECT RUN_METRIC('chrome/event_latency_scroll_jank_cause.sql'); 20 21DROP VIEW IF EXISTS chrome_scroll_jank_v2_output; 22 23CREATE VIEW chrome_scroll_jank_v2_output 24AS 25SELECT 26 ChromeScrollJankV2( 27 'scroll_processing_ms', 28 scroll_processing_ms, 29 'scroll_jank_processing_ms', 30 scroll_jank_processing_ms, 31 'scroll_jank_percentage', 32 scroll_jank_percentage) 33FROM 34 ( 35 SELECT 36 100.0 * scroll_jank_processing_ms / scroll_processing_ms 37 AS scroll_jank_percentage, 38 * 39 FROM 40 ( 41 SELECT 42 COALESCE(SUM(jank.dur), 0) / 1.0e6 AS scroll_processing_ms, 43 COALESCE( 44 SUM( 45 CASE 46 WHEN 47 jank.jank 48 AND cause.cause_of_jank != 'RendererCompositorQueueingDelay' 49 THEN jank.dur 50 ELSE 0 51 END), 52 0) 53 / 1.0e6 AS scroll_jank_processing_ms 54 FROM 55 scroll_event_latency_jank AS jank 56 LEFT JOIN 57 event_latency_scroll_jank_cause AS cause 58 ON 59 jank.id = cause.slice_id 60 ) 61 ); 62