Commit 1304fb99 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[tools/perf] Use power_drain_in_watts from trace_processor

drain_in_watts and power_counters are now in trace_processor so use
RUN_METRIC and remove the duplication in tbmv3.

Change-Id: If34bde8ac437525d4ffd83e851ac5a9e1274dbf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429066
Auto-Submit: Dan Elphick <delphick@chromium.org>
Commit-Queue: Mikhail Khokhlov <khokhlov@google.com>
Reviewed-by: default avatarMikhail Khokhlov <khokhlov@google.com>
Cr-Commit-Position: refs/heads/master@{#818477}
parent 36d6f823
...@@ -4,47 +4,7 @@ ...@@ -4,47 +4,7 @@
-- See go/power-mobile-benchmark for the list of supported devices. -- See go/power-mobile-benchmark for the list of supported devices.
-- Output values are in Joules (Watt-seconds). -- Output values are in Joules (Watt-seconds).
-- This is a mapping from counter names on different devices SELECT RUN_METRIC('android/power_drain_in_watts.sql');
-- to what subsystems they are measuring.
CREATE TABLE power_counters (name TEXT, subsystem TEXT);
INSERT INTO power_counters VALUES
('power.VPH_PWR_S5C_S6C_uws', 'cpu_big'),
('power.VPH_PWR_S4C_uws', 'cpu_little'),
('power.VPH_PWR_S2C_S3C_uws', 'soc'),
('power.VPH_PWR_OLED_uws', 'display'),
('power.PPVAR_VPH_PWR_S1A_S9A_S10A_uws', 'soc'),
('power.PPVAR_VPH_PWR_S2A_S3A_uws', 'cpu_big'),
('power.PPVAR_VPH_PWR_S1C_uws', 'cpu_little'),
('power.WCN3998_VDD13 [from PP1304_L2C]_uws', 'wifi'),
('power.PPVAR_VPH_PWR_WLAN_uws', 'wifi'),
('power.PPVAR_VPH_PWR_OLED_uws', 'display'),
('power.PPVAR_VPH_PWR_QTM525_uws', 'cellular'),
('power.PPVAR_VPH_PWR_RF_uws', 'cellular');
-- Convert power counter data into table of events, where each event has
-- start timestamp, duration and the average power drain during its duration
-- in Watts.
-- Note that power counters wrap around at different values on different
-- devices. When that happens, we ignore the value before overflow, and only
-- take into account the value after it. This underestimates the actual power
-- drain between those counters.
CREATE VIEW drain_in_watts AS
SELECT
name,
ts,
LEAD(ts) OVER (PARTITION BY track_id ORDER BY ts) - ts as dur,
CASE
WHEN LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) >= value
THEN (LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) - value)
ELSE LEAD(value) OVER (PARTITION BY track_id ORDER BY ts)
END /
(LEAD(ts) OVER (PARTITION BY track_id ORDER BY ts) - ts) * 1e3
AS drain_w
FROM counter
JOIN counter_track ON (counter.track_id = counter_track.id)
WHERE
counter_track.type = 'counter_track' AND name LIKE "power.%";
CREATE VIEW run_story_event AS CREATE VIEW run_story_event AS
SELECT ts, dur SELECT ts, dur
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment