Commit a2c80ec2 authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

[tools/perf] Use power proxy metric in webview power metric

This change replaces the CPU usage WebView metric with the one that
estimates power usage using power profiles.
The initial version calculates the power usage of WebView slices.

Bug: b/158665114
Change-Id: I9bfc646ba38cb298f5cc5c977c928ab16fe79024
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247348Reviewed-by: default avatarMikhail Khokhlov <khokhlov@google.com>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780014}
parent 7b0c35e4
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;
}
SELECT RUN_METRIC('webview/webview_cpu_usage.sql');
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)
);
syntax = "proto2";
package perfetto.protos;
import "protos/perfetto/metrics/metrics.proto";
import "protos/perfetto/metrics/custom_options.proto";
// WebView is embedded in the hosting app's main process, which means it shares
// some threads with the host app's work. We 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.
// Output values are in milliampere-seconds.
message EstimatedWebViewAppPowerUsage {
string app_name = 1; // process name
// total app’s power consumption in milliampere-seconds
// TODO(b/159154163): make this required.
optional double total_app_power_mas = 2;
// this is the sum of the following 3 fields
double webview_power_mas = 3;
// TODO(b/159154263): make this required.
optional double webview_power_little_cores_mas = 4;
optional double webview_power_big_cores_mas = 5;
optional double webview_power_bigger_cores_mas = 6;
}
message WebViewPowerUsageMetric {
repeated EstimatedWebViewAppPowerUsage estimated_webview_app_power_usage = 1;
}
extend TraceMetrics {
optional WebViewPowerUsageMetric webview_power_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. We 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.
-- This metric requires the power_profile table to be filled with the device power
-- profile data.
-- Output values are in milliampere-seconds.
SELECT RUN_METRIC('webview/webview_power_usage.sql');
CREATE VIEW webview_power_usage_metric_output AS
SELECT WebViewPowerUsageMetric(
'estimated_webview_app_power_usage',
(SELECT RepeatedField(
EstimatedWebViewAppPowerUsage(
'app_name', app_name,
'webview_power_mas', webview_power_mas
)
)
FROM webview_power_summary
)
);
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