1-- 2-- Copyright 2021 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-- Find all counters from track that satisfies regex 'slc/qurg2_(wr|rd):lvl=0x(0|1|3|7)%' 18DROP VIEW IF EXISTS all_qurg2; 19CREATE VIEW all_qurg2 AS 20SELECT 21 ts, 22 track_id, 23 name, 24 value 25FROM counters 26WHERE name GLOB 'slc/qurg2_??:lvl=0x_*'; 27 28-- Find all counters from track that satisfies regex 'slc/qurg2_(wr|rd):lvl=0x(1|3|7)%' 29DROP VIEW IF EXISTS non_zero_qurg2; 30CREATE VIEW non_zero_qurg2 AS 31SELECT 32 * 33FROM all_qurg2 34WHERE name NOT GLOB 'slc/qurg2_??:lvl=0x0*'; 35 36DROP VIEW IF EXISTS android_simpleperf_output; 37CREATE VIEW android_simpleperf_output AS 38SELECT AndroidSimpleperfMetric( 39 'urgent_ratio', (SELECT sum(value) FROM non_zero_qurg2) / (SELECT sum(value) FROM all_qurg2) 40); 41