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 16DROP VIEW IF EXISTS clone_duration_output; 17CREATE PERFETTO VIEW clone_duration_output AS 18SELECT 19 CloneDuration( 20 'by_buffer', ( 21 WITH clone_started_ns AS ( 22 SELECT value 23 FROM stats 24 WHERE name = 'traced_clone_started_timestamp_ns' 25 LIMIT 1 26 ) 27 SELECT 28 RepeatedField(CloneDuration_ByBuffer( 29 'buffer', 30 idx, 31 'duration_ns', 32 value - (SELECT value FROM clone_started_ns) 33 )) 34 FROM stats 35 WHERE 36 name = 'traced_buf_clone_done_timestamp_ns' 37 AND (SELECT value FROM clone_started_ns) <> 0 38 ORDER BY idx 39 ) 40 ); 41