Commit a4420186 authored by Yi Gu's avatar Yi Gu Committed by Commit Bot

Revert "[tools/perf] Add webview_cpu_usage metric"

This reverts commit 5c76e821.

Reason for revert: Caused consistent failure on the following bot:
https://ci.chromium.org/p/chromium/builders/ci/Win%207%20Tests%20x64%20%281%29/67399

Original change's description:
> [tools/perf] Add webview_cpu_usage metric
> 
> This change adds a metric that calculates the amount of time WebView
> spends on different frequencies.
> 
> Bug: b/157855323
> Change-Id: Ibb1fa61cc2ba1479f2b76ef642dc03c64a9a14b5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2231452
> Reviewed-by: Mikhail Khokhlov <khokhlov@google.com>
> Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#775713}

TBR=oksamyt@chromium.org,khokhlov@google.com

Change-Id: I58544fcad9e209ee005a4b6e5981ef780ab4b6d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/157855323
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2233681Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775753}
parent 14cfdb78
syntax = "proto2";
package perfetto.protos;
import "protos/perfetto/metrics/metrics.proto";
import "protos/perfetto/metrics/custom_options.proto";
message WebViewCPUUsageMetric {
optional int64 cpu_time_nanos_below_1ghz = 1;
optional int64 cpu_time_nanos_above_1ghz = 2;
};
extend TraceMetrics {
optional WebViewCPUUsageMetric webview_cpu_usage_metric = 458;
}
-- WebView is embedded in the hosting app's main process, which means it shares some threads
-- with the host app's work. In the future, we will approximate WebView-related power usage
-- by selecting user slices that belong to WebView and estimating their power use
-- through the CPU time they consume at different core frequencies.
-- The initial version of this metric calculates the total time (in nanoseconds)
-- WebView slices spend in different frequency ranges.
SELECT RUN_METRIC('android/android_cpu.sql');
DROP VIEW IF EXISTS webview_slice;
CREATE VIEW webview_slice AS
SELECT *
FROM
-- TODO(b/156788923): add better conditions.
slice WHERE category = 'android_webview';
DROP VIEW IF EXISTS top_level_webview_slice;
-- Since we filter out some slices in webview_slice above, we cannot use the "depth" column
-- to select only the top-level webview slices. Instead, we have to join webview_slice with itself,
-- selecting only those events that do not have any children in webview_slice.
CREATE VIEW top_level_webview_slice AS
SELECT *
FROM
webview_slice s1 WHERE
(SELECT COUNT(1)
FROM (
SELECT *
FROM
webview_slice s2
WHERE s1.track_id = s2.track_id
AND s2.ts < s1.ts
AND s2.ts + s2.dur > s1.ts + s1.dur
LIMIT 1)
) == 0;
DROP VIEW IF EXISTS slices_threads;
CREATE VIEW slices_threads AS
SELECT
top_level_webview_slice.ts,
top_level_webview_slice.dur,
thread_track.utid
FROM top_level_webview_slice INNER JOIN thread_track
ON top_level_webview_slice.track_id = thread_track.id;
DROP TABLE IF EXISTS slices_freq;
CREATE VIRTUAL TABLE slices_freq
USING SPAN_JOIN (cpu_freq_sched_per_thread PARTITIONED utid,
slices_threads PARTITIONED utid);
-- Get frequencies by utid and cpu.
SELECT RUN_METRIC('android/android_cpu_raw_metrics_per_core.sql',
'input_table', 'slices_freq',
'output_table', 'webview_raw_metrics_per_core');
-- TODO(b/155980166): use another query to estimate power consumption based on frequencies.
CREATE VIEW webview_cpu_usage_metric_output AS
SELECT WebViewCPUUsageMetric(
'cpu_time_nanos_below_1ghz',
(SELECT IFNULL(CAST(SUM(runtime_ns) AS INT), 0)
FROM
webview_raw_metrics_per_core
WHERE avg_freq_khz < 1000000),
'cpu_time_nanos_above_1ghz',
(SELECT IFNULL(CAST(SUM(runtime_ns) AS INT), 0)
FROM
webview_raw_metrics_per_core
WHERE avg_freq_khz >= 1000000)
);
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