1/* 2 * Copyright (C) 2019 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 * http://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 17-- use the 'launching: $process_name' async slice to figure out launch duration. 18DROP VIEW IF EXISTS launch_durations_named; 19 20CREATE VIEW launch_durations_named AS 21WITH 22 launch_traces_raw AS ( 23 SELECT * 24 FROM tracing_mark_write_split AS tmw, 25 raw_ftrace_entries AS rfe 26 WHERE atrace_message LIKE 'launching: %' AND rfe.id = tmw.raw_ftrace_entry_id 27 ), 28 launch_traces_joined AS ( 29 SELECT started.timestamp AS started_timestamp, 30 finished.timestamp AS finished_timestamp, 31 started.id AS started_id, 32 finished.id AS finished_id, 33 SUBSTR(started.atrace_message, 12) AS proc_name -- crop out "launching: " from the string. 34 FROM launch_traces_raw AS started, 35 launch_traces_raw AS finished 36 -- async slices ('S' -> 'F') have matching counters given the same PID. 37 WHERE started.atrace_type == 'S' 38 AND finished.atrace_type == 'F' 39 AND started.atrace_count == finished.atrace_count 40 AND started.atrace_pid == finished.atrace_pid 41 ) 42SELECT * from launch_traces_joined; 43 44SELECT * FROM launch_durations_named; 45