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.cpu_split; 17 18-- Find the CPU states creating the max vote 19CREATE PERFETTO TABLE _w_cpu_dependence AS 20WITH 21 max_power_tbl AS ( 22 SELECT 23 *, 24 -- Indicates if all CPUs are in deep idle 25 min( 26 no_static, 27 coalesce(idle_4, 1), 28 coalesce(idle_5, 1), 29 coalesce(idle_6, 1), 30 coalesce(idle_7, 1) 31 ) AS all_cpu_deep_idle, 32 -- Determines which CPU has highest vote 33 max(static_4, static_5, static_6, static_7) AS max_static_vote 34 FROM _w_independent_cpus_calc, _skip_devfreq_for_calc 35 ) 36SELECT 37 ts, 38 dur, 39 freq_0, 40 idle_0, 41 freq_1, 42 idle_1, 43 freq_2, 44 idle_2, 45 freq_3, 46 idle_3, 47 cpu0_curve, 48 cpu1_curve, 49 cpu2_curve, 50 cpu3_curve, 51 cpu4_curve, 52 cpu5_curve, 53 cpu6_curve, 54 cpu7_curve, 55 l3_hit_count, 56 l3_miss_count, 57 suspended, 58 no_static, 59 all_cpu_deep_idle, 60 CASE max_static_vote 61 WHEN -1 62 THEN _get_min_freq_vote() 63 WHEN static_4 64 THEN freq_4 65 WHEN static_5 66 THEN freq_5 67 WHEN static_6 68 THEN freq_6 69 WHEN static_7 70 THEN freq_7 71 ELSE 400000 72 END AS dependent_freq, 73 CASE max_static_vote 74 WHEN -1 75 THEN _get_min_policy_vote() 76 WHEN static_4 77 THEN policy_4 78 WHEN static_5 79 THEN policy_5 80 WHEN static_6 81 THEN policy_6 82 WHEN static_7 83 THEN policy_7 84 ELSE 4 85 END AS dependent_policy 86FROM max_power_tbl; 87