chromium/tools/perf/core/tbmv3/metrics/webview_power_usage_metric.proto

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 UsageByCoreType {
  double little_cores_mas = 1;
  double big_cores_mas = 2;
  double bigger_core_mas = 3;
  double total_mas = 4;  // sum of the fields above
}

message EstimatedWebViewAppPowerUsage {
  // Host app package name.
  string app_name = 1;

  // Only browser + in-process renderer slices.
  double webview_browser_slices_mas = 2;

  // WebView-only browser + in-process renderer threads.
  UsageByCoreType webview_only_usage = 3;

  // All threads of the host app.
  UsageByCoreType total_app_usage = 4;

  // All out-of-process renderers.
  UsageByCoreType renderer_usage = 5;
}

message WebViewPowerUsageMetric {
  repeated EstimatedWebViewAppPowerUsage estimated_webview_app_power_usage = 1;

  // Total power usage of the device (all apps).
  double total_device_power_mas = 2;
}

extend TraceMetrics {
  optional WebViewPowerUsageMetric webview_power_usage_metric = 458;
}