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