1-- 2-- Copyright 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-- 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 17-- Expose all clock snapshots as instant events. 18DROP VIEW IF EXISTS trace_metadata_event; 19CREATE VIEW trace_metadata_event AS 20SELECT 21 'slice' AS track_type, 22 'Clock Snapshots' AS track_name, 23 ts, 24 0 AS dur, 25 'Snapshot' AS slice_name 26FROM clock_snapshot 27GROUP BY ts; 28 29DROP VIEW IF EXISTS trace_metadata_output; 30CREATE VIEW trace_metadata_output AS 31SELECT TraceMetadata( 32 'trace_duration_ns', CAST((SELECT end_ts - start_ts FROM trace_bounds) AS INT), 33 'trace_uuid', (SELECT str_value FROM metadata WHERE name = 'trace_uuid'), 34 'android_build_fingerprint', ( 35 SELECT str_value FROM metadata WHERE name = 'android_build_fingerprint' 36 ), 37 'statsd_triggering_subscription_id', ( 38 SELECT int_value FROM metadata 39 WHERE name = 'statsd_triggering_subscription_id' 40 ), 41 'unique_session_name', ( 42 SELECT str_value FROM metadata 43 WHERE name = 'unique_session_name' 44 ), 45 'trace_size_bytes', ( 46 SELECT int_value FROM metadata 47 WHERE name = 'trace_size_bytes' 48 ), 49 'trace_trigger', ( 50 SELECT RepeatedField(slice.name) 51 FROM track JOIN slice ON track.id = slice.track_id 52 WHERE track.name = 'Trace Triggers' 53 ), 54 'trace_config_pbtxt', ( 55 SELECT str_value FROM metadata 56 WHERE name = 'trace_config_pbtxt' 57 ), 58 'sched_duration_ns', ( 59 SELECT MAX(ts) - MIN(ts) FROM sched 60 ) 61); 62