[wv] Add a jank approximation metric for WebView
This CL adds trace processor support for running WebView trace-based metrics
by following Chrome's example. Also adds a new webview_jank_approximation
metric that calculates the number of janks overlapping WebView renderer slices.
Bug: 273555049
Change-Id: I998765921b7f7a9bf8c98f0355290e7d8919a428
diff --git a/Android.bp b/Android.bp
index 81477a0..7a44cd2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -2243,6 +2243,7 @@
"perfetto_src_trace_processor_importers_proto_gen_cc_trace_descriptor",
"perfetto_src_trace_processor_importers_proto_gen_cc_track_event_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
"perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
"perfetto_src_trace_processor_stdlib_gen_amalgamated_stdlib",
@@ -4413,6 +4414,64 @@
],
}
+// GN: //protos/perfetto/metrics/webview:descriptor
+genrule {
+ name: "perfetto_protos_perfetto_metrics_webview_descriptor",
+ srcs: [
+ "protos/perfetto/metrics/android/android_blocking_calls_cuj_metric.proto",
+ "protos/perfetto/metrics/android/android_frame_timeline_metric.proto",
+ "protos/perfetto/metrics/android/android_trusty_workqueues.proto",
+ "protos/perfetto/metrics/android/batt_metric.proto",
+ "protos/perfetto/metrics/android/binder_metric.proto",
+ "protos/perfetto/metrics/android/camera_metric.proto",
+ "protos/perfetto/metrics/android/camera_unagg_metric.proto",
+ "protos/perfetto/metrics/android/cpu_metric.proto",
+ "protos/perfetto/metrics/android/display_metrics.proto",
+ "protos/perfetto/metrics/android/dma_heap_metric.proto",
+ "protos/perfetto/metrics/android/dvfs_metric.proto",
+ "protos/perfetto/metrics/android/fastrpc_metric.proto",
+ "protos/perfetto/metrics/android/g2d_metric.proto",
+ "protos/perfetto/metrics/android/gpu_metric.proto",
+ "protos/perfetto/metrics/android/hwcomposer.proto",
+ "protos/perfetto/metrics/android/hwui_metric.proto",
+ "protos/perfetto/metrics/android/ion_metric.proto",
+ "protos/perfetto/metrics/android/irq_runtime_metric.proto",
+ "protos/perfetto/metrics/android/jank_cuj_metric.proto",
+ "protos/perfetto/metrics/android/java_heap_histogram.proto",
+ "protos/perfetto/metrics/android/java_heap_stats.proto",
+ "protos/perfetto/metrics/android/lmk_metric.proto",
+ "protos/perfetto/metrics/android/lmk_reason_metric.proto",
+ "protos/perfetto/metrics/android/mem_metric.proto",
+ "protos/perfetto/metrics/android/mem_unagg_metric.proto",
+ "protos/perfetto/metrics/android/monitor_contention_metric.proto",
+ "protos/perfetto/metrics/android/multiuser_metric.proto",
+ "protos/perfetto/metrics/android/network_metric.proto",
+ "protos/perfetto/metrics/android/other_traces.proto",
+ "protos/perfetto/metrics/android/package_list.proto",
+ "protos/perfetto/metrics/android/powrails_metric.proto",
+ "protos/perfetto/metrics/android/process_metadata.proto",
+ "protos/perfetto/metrics/android/profiler_smaps.proto",
+ "protos/perfetto/metrics/android/rt_runtime_metric.proto",
+ "protos/perfetto/metrics/android/simpleperf.proto",
+ "protos/perfetto/metrics/android/startup_metric.proto",
+ "protos/perfetto/metrics/android/surfaceflinger.proto",
+ "protos/perfetto/metrics/android/task_names.proto",
+ "protos/perfetto/metrics/android/thread_time_in_state_metric.proto",
+ "protos/perfetto/metrics/android/trace_quality.proto",
+ "protos/perfetto/metrics/android/unsymbolized_frames.proto",
+ "protos/perfetto/metrics/metrics.proto",
+ "protos/perfetto/metrics/webview/all_webview_metrics.proto",
+ "protos/perfetto/metrics/webview/webview_jank_approximation.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --descriptor_set_out=$(out) $(in)",
+ out: [
+ "perfetto_protos_perfetto_metrics_webview_descriptor.bin",
+ ],
+}
+
// GN: //protos/perfetto/trace/android:cpp
genrule {
name: "perfetto_protos_perfetto_trace_android_cpp_gen",
@@ -9724,6 +9783,21 @@
],
}
+// GN: //src/trace_processor/metrics:gen_cc_all_webview_metrics_descriptor
+genrule {
+ name: "perfetto_src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor",
+ srcs: [
+ ":perfetto_protos_perfetto_metrics_webview_descriptor",
+ ],
+ cmd: "$(location tools/gen_cc_proto_descriptor.py) --gen_dir=$(genDir) --cpp_out=$(out) $(in)",
+ out: [
+ "src/trace_processor/metrics/all_webview_metrics.descriptor.h",
+ ],
+ tool_files: [
+ "tools/gen_cc_proto_descriptor.py",
+ ],
+}
+
// GN: //src/trace_processor/metrics:gen_cc_metrics_descriptor
genrule {
name: "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
@@ -9913,6 +9987,7 @@
"src/trace_processor/metrics/sql/experimental/reported_by_page.sql",
"src/trace_processor/metrics/sql/trace_metadata.sql",
"src/trace_processor/metrics/sql/trace_stats.sql",
+ "src/trace_processor/metrics/sql/webview/webview_jank_approximation.sql",
"src/trace_processor/metrics/sql/webview/webview_power_usage.sql",
],
cmd: "$(location tools/gen_amalgamated_sql.py) --namespace=sql_metrics --cpp-out=$(out) $(in)",
@@ -11953,6 +12028,7 @@
"perfetto_src_trace_processor_importers_proto_gen_cc_trace_descriptor",
"perfetto_src_trace_processor_importers_proto_gen_cc_track_event_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
"perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
"perfetto_src_trace_processor_stdlib_gen_amalgamated_stdlib",
@@ -12468,6 +12544,7 @@
"perfetto_src_trace_processor_importers_proto_gen_cc_trace_descriptor",
"perfetto_src_trace_processor_importers_proto_gen_cc_track_event_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
"perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
"perfetto_src_trace_processor_stdlib_gen_amalgamated_stdlib",
@@ -12690,6 +12767,7 @@
"perfetto_src_trace_processor_importers_proto_gen_cc_trace_descriptor",
"perfetto_src_trace_processor_importers_proto_gen_cc_track_event_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
+ "perfetto_src_trace_processor_metrics_gen_cc_all_webview_metrics_descriptor",
"perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
"perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
"perfetto_src_trace_processor_stdlib_gen_amalgamated_stdlib",