diff --git a/src/trace_processor/perfetto_sql/stdlib/prelude/tables_views.sql b/src/trace_processor/perfetto_sql/stdlib/prelude/tables_views.sql index 6411698611..510c47d3b6 100644 --- a/src/trace_processor/perfetto_sql/stdlib/prelude/tables_views.sql +++ b/src/trace_processor/perfetto_sql/stdlib/prelude/tables_views.sql @@ -15,6 +15,39 @@ INCLUDE PERFETTO MODULE prelude.views; +-- Tracks are a fundamental concept in trace processor and represent a +-- "timeline" for events of the same type and with the same context. See +-- https://perfetto.dev/docs/analysis/trace-processor#tracks for a more +-- detailed explanation, with examples. +CREATE PERFETTO VIEW track ( + -- Unique identifier for this track. Identical to |track_id|, prefer using + -- |track_id| instead. + id UINT, + -- The name of the "most-specific" child table containing this row. + type STRING, + -- Name of the track; can be null for some types of tracks (e.g. thread + -- tracks). + name STRING, + -- The track which is the "parent" of this track. Only non-null for tracks + -- created using Perfetto's track_event API. + parent_id UINT, + -- Args for this track which store information about "source" of this track + -- in the trace. For example: whether this track orginated from atrace, + -- Chrome tracepoints etc. Alias of `args.arg_set_id`. + source_arg_set_id UINT, + -- Machine identifier, non-null for tracks on a remote machine. + machine_id UINT +) AS +SELECT + id, + type AS type, + name, + parent_id, + source_arg_set_id, + machine_id +FROM + __intrinsic_track; + -- Contains information about the CPUs on the device this trace was taken on. CREATE PERFETTO VIEW cpu ( -- Unique identifier for this CPU. Identical to |ucpu|, prefer using |ucpu| @@ -35,7 +68,7 @@ CREATE PERFETTO VIEW cpu ( machine_id UINT, -- Capacity of a CPU of a device, a metric which indicates the -- relative performance of a CPU on a device - -- For details see: + -- For details see: -- https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/cpu-capacity.txt capacity UINT ) AS diff --git a/src/trace_processor/tables/track_tables.py b/src/trace_processor/tables/track_tables.py index 3cf55a8789..411f80184c 100644 --- a/src/trace_processor/tables/track_tables.py +++ b/src/trace_processor/tables/track_tables.py @@ -21,6 +21,7 @@ from python.generators.trace_processor_table.public import Table from python.generators.trace_processor_table.public import TableDoc from python.generators.trace_processor_table.public import ColumnDoc +from python.generators.trace_processor_table.public import ColumnFlag from python.generators.trace_processor_table.public import CppSelfTableId from python.generators.trace_processor_table.public import CppTableId from python.generators.trace_processor_table.public import CppUint32 @@ -30,12 +31,14 @@ TRACK_TABLE = Table( python_module=__file__, class_name="TrackTable", - sql_name="track", + sql_name="__intrinsic_track", columns=[ C("name", CppString()), C("parent_id", CppOptional(CppSelfTableId())), C("source_arg_set_id", CppOptional(CppUint32())), C('machine_id', CppOptional(CppTableId(MACHINE_TABLE))), + C("classification", CppOptional(CppString()), flags=ColumnFlag.HIDDEN), + C("tags", CppOptional(CppUint32()), flags=ColumnFlag.HIDDEN), ], tabledoc=TableDoc( doc=''' @@ -68,6 +71,15 @@ ''' Machine identifier, non-null for tracks on a remote machine. ''', + 'classification': + ''' + Classification of this track. Responsible for grouping + similar tracks together. + ''', + 'tags': + ColumnDoc( + doc='Additional details about the track.', + joinable='args.arg_set_id'), })) PROCESS_TRACK_TABLE = Table( diff --git a/test/trace_processor/diff_tests/parser/android/android_system_property_slice.out b/test/trace_processor/diff_tests/parser/android/android_system_property_slice.out deleted file mode 100644 index 4783a2cb8c..0000000000 --- a/test/trace_processor/diff_tests/parser/android/android_system_property_slice.out +++ /dev/null @@ -1,3 +0,0 @@ -"type","name","id","ts","dur","type","name" -"track","DeviceStateChanged",0,1000,0,"__intrinsic_slice","some_state_from_sysprops" -"track","DeviceStateChanged",1,3000,0,"__intrinsic_slice","some_state_from_atrace" diff --git a/test/trace_processor/diff_tests/parser/android/tests.py b/test/trace_processor/diff_tests/parser/android/tests.py index 6a20f5979e..ab9e4a13ce 100644 --- a/test/trace_processor/diff_tests/parser/android/tests.py +++ b/test/trace_processor/diff_tests/parser/android/tests.py @@ -106,11 +106,15 @@ def test_android_system_property_slice(self): } """), query=""" - SELECT t.type, t.name, s.id, s.ts, s.dur, s.type, s.name + SELECT t.name, s.id, s.ts, s.dur, s.type, s.name FROM track t JOIN slice s ON s.track_id = t.id WHERE t.name = 'DeviceStateChanged'; """, - out=Path('android_system_property_slice.out')) + out=Csv(""" + "name","id","ts","dur","type","name" + "DeviceStateChanged",0,1000,0,"__intrinsic_slice","some_state_from_sysprops" + "DeviceStateChanged",1,3000,0,"__intrinsic_slice","some_state_from_atrace" + """)) def test_binder_txn_sync_good(self): return DiffTestBlueprint( diff --git a/ui/src/core_plugins/async_slices/index.ts b/ui/src/core_plugins/async_slices/index.ts index d0cf31d0c8..e07d0ccf51 100644 --- a/ui/src/core_plugins/async_slices/index.ts +++ b/ui/src/core_plugins/async_slices/index.ts @@ -37,7 +37,7 @@ class AsyncSlicePlugin implements Plugin { count() as trackCount from track t join _slice_track_summary using (id) - where t.type in ('track', 'gpu_track', 'cpu_track') + where t.type in ('__intrinsic_track', 'gpu_track', 'cpu_track') group by parent_id, name ) select