1-- 2-- Copyright 2021 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-- Find all dropped frames, i.e. all PipelineReporters slices whose 17-- state is 'STATE_DROPPED'. 18DROP TABLE IF EXISTS dropped_pipeline_reporter_slice; 19CREATE PERFETTO TABLE dropped_pipeline_reporter_slice AS 20SELECT slice.* FROM slice 21JOIN args 22 ON slice.arg_set_id = args.arg_set_id 23WHERE 24 slice.name = 'PipelineReporter' 25 AND args.string_value = 'STATE_DROPPED'; 26 27-- Find the upid of the proccesses where the dropped frames occur. 28DROP VIEW IF EXISTS dropped_frames_with_upid; 29CREATE PERFETTO VIEW dropped_frames_with_upid AS 30SELECT 31 dropped_pipeline_reporter_slice.ts, 32 process_track.upid 33FROM dropped_pipeline_reporter_slice 34JOIN process_track 35 ON dropped_pipeline_reporter_slice.track_id = process_track.id; 36 37-- Find the name and pid of the processes. 38-- If the process name represents a file's pathname, the path part will be 39-- removed from the display name of the process. 40DROP VIEW IF EXISTS dropped_frames_with_process_info; 41CREATE PERFETTO VIEW dropped_frames_with_process_info AS 42SELECT 43 dropped_frames_with_upid.ts, 44 REPLACE( 45 process.name, 46 RTRIM( 47 process.name, 48 REPLACE(process.name, '/', '') 49 ), 50 '') AS process_name, 51 process.pid AS process_id 52FROM dropped_frames_with_upid 53JOIN process 54 ON dropped_frames_with_upid.upid = process.upid; 55 56-- Create the dropped frames metric output. 57DROP VIEW IF EXISTS chrome_dropped_frames_output; 58CREATE PERFETTO VIEW chrome_dropped_frames_output AS 59SELECT ChromeDroppedFrames( 60 'dropped_frame', ( 61 SELECT RepeatedField( 62 ChromeDroppedFrames_DroppedFrame( 63 'ts', ts, 64 'process_name', process_name, 65 'pid', process_id 66 ) 67 ) 68 FROM dropped_frames_with_process_info 69 ORDER BY ts 70 ) 71); 72