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. 15SELECT RUN_METRIC('chrome/scroll_flow_event_queuing_delay.sql') 16 AS suppress_query_output; 17 18SELECT 19 -- Each trace_id (in our example trace not true in general) has 8 steps. There 20 -- are 139 scrolls. So we expect 1112 rows in total 72 of which are janky. 21 ( 22 SELECT 23 COUNT(*) 24 FROM ( 25 SELECT 26 trace_id, 27 COUNT(*) 28 FROM scroll_flow_event_queuing_delay 29 GROUP BY trace_id 30 ) 31 ) AS total_scroll_updates, 32 ( 33 SELECT COUNT(*) FROM scroll_flow_event_queuing_delay 34 ) AS total_flow_event_steps, 35 ( 36 SELECT COUNT(*) FROM scroll_flow_event_queuing_delay WHERE jank 37 ) AS total_janky_flow_event_steps, 38 ( 39 SELECT COUNT(*) FROM (SELECT step FROM scroll_flow_event_queuing_delay GROUP BY step) 40 ) AS number_of_unique_steps; 41