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 17DROP VIEW IF EXISTS trace_metadata_output; 18CREATE VIEW trace_metadata_output AS 19SELECT TraceMetadata( 20 'trace_duration_ns', CAST((SELECT end_ts - start_ts FROM trace_bounds) AS INT), 21 'trace_uuid', (SELECT str_value FROM metadata WHERE name = 'trace_uuid'), 22 'android_build_fingerprint', ( 23 SELECT str_value FROM metadata WHERE name = 'android_build_fingerprint' 24 ), 25 'statsd_triggering_subscription_id', ( 26 SELECT int_value FROM metadata 27 WHERE name = 'statsd_triggering_subscription_id' 28 ), 29 'unique_session_name', ( 30 SELECT str_value FROM metadata 31 WHERE name = 'unique_session_name' 32 ), 33 'trace_size_bytes', ( 34 SELECT int_value FROM metadata 35 WHERE name = 'trace_size_bytes' 36 ), 37 'trace_trigger', ( 38 SELECT RepeatedField(slice.name) 39 FROM track JOIN slice ON track.id = slice.track_id 40 WHERE track.name = 'Trace Triggers' 41 ), 42 'trace_config_pbtxt', ( 43 SELECT str_value FROM metadata 44 WHERE name = 'trace_config_pbtxt' 45 ), 46 'sched_duration_ns', ( 47 SELECT MAX(ts) - MIN(ts) from sched 48 ) 49); 50