• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.device;
17INCLUDE PERFETTO MODULE wattson.device_infos;
18
19-- 1D LUT
20CREATE PERFETTO TABLE _filtered_curves_1d_raw AS
21SELECT cp.policy, freq_khz, active, idle0, idle1, static
22FROM _device_curves_1d as dc
23JOIN _wattson_device as device ON dc.device = device.name
24JOIN _dev_cpu_policy_map as cp ON dc.policy = cp.policy;
25
26CREATE TABLE _filtered_curves_1d AS
27SELECT policy, freq_khz, -1 as idle, active as curve_value
28FROM _filtered_curves_1d_raw
29UNION
30SELECT policy, freq_khz, 0, idle0
31FROM _filtered_curves_1d_raw
32UNION
33SELECT policy, freq_khz, 1, idle1
34FROM _filtered_curves_1d_raw
35UNION
36SELECT policy, freq_khz, 255, static
37FROM _filtered_curves_1d_raw;
38
39CREATE INDEX freq_1d ON _filtered_curves_1d(policy, freq_khz, idle);
40
41-- 2D LUT; with dependency on another CPU
42CREATE PERFETTO TABLE _filtered_curves_2d_raw AS
43SELECT
44  cp.policy as other_policy,
45  dc.freq_khz,
46  dc.other_freq_khz,
47  dc.active,
48  dc.idle0,
49  dc.idle1,
50  dc.static
51FROM _device_curves_2d as dc
52JOIN _wattson_device as device ON dc.device = device.name
53JOIN _dev_cpu_policy_map as cp ON dc.other_policy = cp.policy;
54
55CREATE TABLE _filtered_curves_2d AS
56SELECT freq_khz, other_policy, other_freq_khz, -1 as idle, active as curve_value
57FROM _filtered_curves_2d_raw
58UNION
59SELECT freq_khz, other_policy, other_freq_khz, 0, idle0
60FROM _filtered_curves_2d_raw
61UNION
62SELECT freq_khz, other_policy, other_freq_khz, 1, idle1
63FROM _filtered_curves_2d_raw
64UNION
65SELECT freq_khz, other_policy, other_freq_khz, 255, static
66FROM _filtered_curves_2d_raw;
67
68CREATE INDEX freq_2d
69ON _filtered_curves_2d(freq_khz, other_policy, other_freq_khz, idle);
70
71-- L3 cache LUT
72CREATE PERFETTO TABLE _filtered_curves_l3_raw AS
73SELECT
74  cp.policy as other_policy,
75  dc.freq_khz,
76  dc.other_freq_khz,
77  dc.l3_hit,
78  dc.l3_miss
79FROM _device_curves_l3 as dc
80JOIN _wattson_device as device ON dc.device = device.name
81JOIN _dev_cpu_policy_map as cp ON dc.other_policy = cp.policy;
82
83CREATE TABLE _filtered_curves_l3 AS
84SELECT
85  freq_khz, other_policy, other_freq_khz, 'hit' as action, l3_hit as curve_value
86FROM _filtered_curves_l3_raw
87UNION
88SELECT
89  freq_khz, other_policy, other_freq_khz, 'miss', l3_miss
90FROM _filtered_curves_l3_raw;
91
92CREATE INDEX freq_l3
93ON _filtered_curves_l3(freq_khz, other_policy, other_freq_khz, action);
94