1-- 2-- Copyright 2022 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 17DROP VIEW IF EXISTS launch_async_events; 18CREATE VIEW launch_async_events AS 19SELECT 20 ts, 21 dur, 22 SUBSTR(name, 19) id 23FROM slice 24WHERE 25 name GLOB 'launchingActivity#*' 26 AND dur != 0 27 AND INSTR(name, ':') = 0; 28 29DROP VIEW IF EXISTS launch_complete_events; 30CREATE VIEW launch_complete_events AS 31SELECT 32 STR_SPLIT(completed, ':completed:', 0) id, 33 STR_SPLIT(completed, ':completed:', 1) package_name 34FROM ( 35 SELECT SUBSTR(name, 19) completed 36 FROM slice 37 WHERE dur = 0 AND name GLOB 'launchingActivity#*:completed:*' 38); 39 40INSERT INTO launches(id, ts, ts_end, dur, package) 41SELECT 42 id, 43 ts, 44 ts + dur ts_end, 45 dur, 46 package_name 47FROM launch_async_events JOIN launch_complete_events USING (id); 48