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 18-- Create the base table (`android_jank_cuj`) containing all completed CUJs 19-- found in the trace. 20SELECT RUN_METRIC('android/jank/cujs.sql'); 21 22DROP VIEW IF EXISTS _wattson_cuj_windows; 23CREATE PERFETTO VIEW _wattson_cuj_windows AS 24SELECT 25 ts, 26 dur, 27 cuj_id as period_id 28FROM android_jank_cuj; 29 30SELECT RUN_METRIC( 31 'android/wattson_rail_relations.sql', 32 'window_table', '_wattson_cuj_windows' 33); 34 35DROP VIEW IF EXISTS wattson_atrace_apps_rails_output; 36CREATE PERFETTO VIEW wattson_atrace_apps_rails_output AS 37SELECT AndroidWattsonTimePeriodMetric( 38 'metric_version', 4, 39 'power_model_version', 1, 40 'period_info', ( 41 SELECT RepeatedField( 42 AndroidWattsonEstimateInfo( 43 'period_id', period_id, 44 'period_name', cuj_name, 45 'period_dur', period_dur, 46 'cpu_subsystem', proto 47 ) 48 ) 49 FROM _estimate_cpu_subsystem_sum AS est 50 JOIN android_jank_cuj AS cuj ON cuj.cuj_id = est.period_id 51 ) 52); 53