1 2-- Copyright 2024 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 16INCLUDE PERFETTO MODULE wattson.curves.estimates; 17 18DROP VIEW IF EXISTS _wattson_period_windows; 19CREATE PERFETTO VIEW _wattson_period_windows AS 20SELECT 21 -- Requirement is there is exactly one pair of start/stop 22 (SELECT ts FROM slice WHERE name == 'wattson_start') as ts, 23 (SELECT ts FROM slice WHERE name == 'wattson_stop') 24 - (SELECT ts FROM slice WHERE name == 'wattson_start') as dur, 25 1 as period_id; 26 27SELECT RUN_METRIC( 28 'android/wattson_rail_relations.sql', 29 'window_table', 30 '_wattson_period_windows' 31); 32 33DROP VIEW IF EXISTS wattson_markers_rails_output; 34CREATE PERFETTO VIEW wattson_markers_rails_output AS 35SELECT AndroidWattsonTimePeriodMetric( 36 'metric_version', 4, 37 'power_model_version', 1, 38 'period_info', ( 39 SELECT RepeatedField( 40 AndroidWattsonEstimateInfo( 41 'period_id', period_id, 42 'period_dur', period_dur, 43 'cpu_subsystem', proto 44 ) 45 ) 46 FROM _estimate_cpu_subsystem_sum 47 ) 48); 49