• 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.cpu_split;
17
18-- The final system state for the CPU subsystem, which has all the information
19-- needed by Wattson to estimate energy for the CPU subsystem.
20CREATE PERFETTO TABLE wattson_system_states(
21  -- Starting timestamp of the current counter where system state is constant.
22  ts LONG,
23  -- Duration of the current counter where system state is constant.
24  dur INT,
25  -- Number of L3 hits the current system state.
26  l3_hit_count INT,
27  -- Number of L3 misses in the current system state.
28  l3_miss_count INT,
29  -- Frequency of CPU0.
30  freq_0 INT,
31  -- Idle state of CPU0.
32  idle_0 INT,
33  -- Frequency of CPU1.
34  freq_1 INT,
35  -- Idle state of CPU1.
36  idle_1 INT,
37  -- Frequency of CPU2.
38  freq_2 INT,
39  -- Idle state of CPU2.
40  idle_2 INT,
41  -- Frequency of CPU3.
42  freq_3 INT,
43  -- Idle state of CPU3.
44  idle_3 INT,
45  -- Frequency of CPU4.
46  freq_4 INT,
47  -- Idle state of CPU4.
48  idle_4 INT,
49  -- Frequency of CPU5.
50  freq_5 INT,
51  -- Idle state of CPU5.
52  idle_5 INT,
53  -- Frequency of CPU6.
54  freq_6 INT,
55  -- Idle state of CPU6.
56  idle_6 INT,
57  -- Frequency of CPU7.
58  freq_7 INT,
59  -- Idle state of CPU7.
60  idle_7 INT,
61  -- Flag indicating if current system state is suspended.
62  suspended BOOL
63)
64AS
65SELECT
66  ts,
67  dur,
68  cast_int!(round(l3_hit_rate * dur, 0)) as l3_hit_count,
69  cast_int!(round(l3_miss_rate * dur, 0)) as l3_miss_count,
70  freq_0,
71  idle_0,
72  freq_1,
73  idle_1,
74  freq_2,
75  idle_2,
76  freq_3,
77  idle_3,
78  freq_4,
79  idle_4,
80  freq_5,
81  idle_5,
82  freq_6,
83  idle_6,
84  freq_7,
85  idle_7,
86  IFNULL(suspended, FALSE) as suspended
87FROM _idle_freq_l3_hit_l3_miss_slice
88-- Needs to be at least 1us to reduce inconsequential rows.
89WHERE dur > time_from_us(1);
90
91