Commit 47b733b6 authored by Mikhail Khokhlov's avatar Mikhail Khokhlov Committed by Commit Bot

[tools/perf] Workaround for counter overflow on different devices

It turns out different devices have different limits for power rails
counters, so we can't compute the exact drain value if we don't know
the device. This CL replaces the exact value with an estimation
in that case.

Change-Id: I8b4f1f63a6b9716a119f5f0a8f001c7801e10eb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236480Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Commit-Queue: Mikhail Khokhlov <khokhlov@google.com>
Cr-Commit-Position: refs/heads/master@{#776555}
parent f57f3548
...@@ -25,8 +25,10 @@ INSERT INTO power_counters VALUES ...@@ -25,8 +25,10 @@ INSERT INTO power_counters VALUES
-- Convert power counter data into table of events, where each event has -- Convert power counter data into table of events, where each event has
-- start timestamp, duration and the average power drain during its duration -- start timestamp, duration and the average power drain during its duration
-- in Watts. -- in Watts.
-- Note that power counters wrap around at 2^30, we take that into account -- Note that power counters wrap around at different values on different
-- when computing average drain between counters. -- 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 CREATE VIEW drain_in_watts AS
SELECT SELECT
name, name,
...@@ -35,7 +37,7 @@ SELECT ...@@ -35,7 +37,7 @@ SELECT
CASE CASE
WHEN LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) >= value WHEN LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) >= value
THEN (LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) - value) THEN (LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) - value)
ELSE (1<<30 + LEAD(value) OVER (PARTITION BY track_id ORDER BY ts) - value) ELSE LEAD(value) OVER (PARTITION BY track_id ORDER BY ts)
END / END /
(LEAD(ts) OVER (PARTITION BY track_id ORDER BY ts) - ts) * 1e3 (LEAD(ts) OVER (PARTITION BY track_id ORDER BY ts) - ts) * 1e3
AS drain_w AS drain_w
......
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