1-- 2-- Copyright 2020 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-- 16 17SELECT RUN_METRIC('android/power_profile_data.sql'); 18 19DROP TABLE IF EXISTS cluster_core_type; 20CREATE TABLE cluster_core_type AS 21 SELECT 0 as cluster, 'little' as core_type 22 UNION ALL 23 SELECT 1, 'big' 24 UNION ALL 25 SELECT 2, 'bigger'; 26 27DROP VIEW IF EXISTS device_power_profile; 28CREATE VIEW device_power_profile AS 29SELECT cpu, cluster, freq, power 30FROM power_profile pp 31WHERE EXISTS ( 32 SELECT 1 FROM metadata 33 WHERE name = 'android_build_fingerprint' AND str_value LIKE '%' || pp.device || '%'); 34 35DROP VIEW IF EXISTS core_cluster_per_cpu; 36CREATE VIEW core_cluster_per_cpu AS 37SELECT DISTINCT cpu, cluster 38FROM device_power_profile; 39 40DROP VIEW IF EXISTS core_type_per_cpu; 41CREATE VIEW core_type_per_cpu AS 42SELECT 43 cpu, 44 core_type 45FROM core_cluster_per_cpu JOIN cluster_core_type USING(cluster); 46 47DROP VIEW IF EXISTS cpu_cluster_power; 48CREATE VIEW cpu_cluster_power AS 49SELECT DISTINCT core_type, freq, power 50FROM device_power_profile pp JOIN cluster_core_type USING(cluster); 51