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 android_other_traces_view; 18CREATE VIEW android_other_traces_view AS 19SELECT 20 ts, 21 dur, 22 SUBSTR(slice.name, 15) AS uuid, 23 'Finalize' AS event_type 24FROM slice 25JOIN track 26 ON track.name = 'OtherTraces' AND slice.track_id = track.id 27WHERE 28 slice.name GLOB 'finalize-uuid-*'; 29 30DROP VIEW IF EXISTS android_other_traces_event; 31CREATE VIEW android_other_traces_event AS 32SELECT 33 'slice' AS track_type, 34 'Other Traces' AS track_name, 35 ts, 36 dur, 37 event_type || ' ' || uuid AS slice_name 38FROM android_other_traces_view; 39 40DROP VIEW IF EXISTS android_other_traces_output; 41CREATE VIEW android_other_traces_output AS 42SELECT AndroidOtherTracesMetric( 43 'finalized_traces_uuid', ( 44 SELECT RepeatedField(uuid) 45 FROM android_other_traces_view 46 WHERE event_type = 'Finalize') 47 ); 48