tp: refactor CPU-indexed tables with the 'ucpu' column
This CL introduces the 'ucpu' column, which is the id of the 'cpu' table
for uniquely identifying CPUs in the multiple-machine tracing context.
The following tables are refactored: cpu, cpu_freq, sched_slice, raw,
ftrace_event, experimental_sched_upid, thread_state. The cpu table is
inserted not only on cpu_info trace packets, but also when CPU-indexed
trace data are injested.
This allows for more efficient query for listing CPU scheduling tracks
in the UI:
* Original: 'select distinct cpu from sched', which scans the sched
table only for distinct cpu indexes
* Update: 'select cpu from cpu', which scans a much smaller cpu table.
Bug: 284258446
Test: diff_tests
Change-Id: I895e1cb4b90c92277bb42b78c01950883641a8c4
diff --git a/Android.bp b/Android.bp
index c46b914..c983b77 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12020,6 +12020,7 @@
"src/trace_processor/importers/common/async_track_set_tracker.cc",
"src/trace_processor/importers/common/clock_converter.cc",
"src/trace_processor/importers/common/clock_tracker.cc",
+ "src/trace_processor/importers/common/cpu_tracker.cc",
"src/trace_processor/importers/common/deobfuscation_mapping_table.cc",
"src/trace_processor/importers/common/event_tracker.cc",
"src/trace_processor/importers/common/flow_tracker.cc",
@@ -13060,6 +13061,7 @@
"src/trace_processor/perfetto_sql/stdlib/pkvm/hypervisor.sql",
"src/trace_processor/perfetto_sql/stdlib/prelude/casts.sql",
"src/trace_processor/perfetto_sql/stdlib/prelude/slices.sql",
+ "src/trace_processor/perfetto_sql/stdlib/prelude/tables_views.sql",
"src/trace_processor/perfetto_sql/stdlib/prelude/trace_bounds.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/states.sql",