aboutsummaryrefslogtreecommitdiff
path: root/src/trace_processor/metrics/android/cpu_info.sql
blob: 1e04a3e68d825e78bf9b8f30d7ae4fb5a70d80ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--
-- Copyright 2020 The Android Open Source Project
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--     https://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

SELECT RUN_METRIC('android/power_profile_data.sql');

DROP TABLE IF EXISTS cluster_core_type;
CREATE TABLE cluster_core_type AS
    SELECT 0 as cluster, 'little' as core_type
    UNION ALL
    SELECT 1, 'big'
    UNION ALL
    SELECT 2, 'bigger';

DROP VIEW IF EXISTS device_power_profile;
CREATE VIEW device_power_profile AS
SELECT cpu, cluster, freq, power
FROM power_profile pp
WHERE EXISTS (
  SELECT 1 FROM metadata
  WHERE name = 'android_build_fingerprint' AND str_value LIKE '%' || pp.device || '%');

DROP VIEW IF EXISTS core_cluster_per_cpu;
CREATE VIEW core_cluster_per_cpu AS
SELECT DISTINCT cpu, cluster
FROM device_power_profile;

DROP VIEW IF EXISTS core_type_per_cpu;
CREATE VIEW core_type_per_cpu AS
SELECT
  cpu,
  core_type
FROM core_cluster_per_cpu JOIN cluster_core_type USING(cluster);

DROP VIEW IF EXISTS cpu_cluster_power;
CREATE VIEW cpu_cluster_power AS
SELECT DISTINCT core_type, freq, power
FROM device_power_profile pp JOIN cluster_core_type USING(cluster);