diff --git a/python/generators/sql_processing/utils.py b/python/generators/sql_processing/utils.py index aab515ca3b..c383284de7 100644 --- a/python/generators/sql_processing/utils.py +++ b/python/generators/sql_processing/utils.py @@ -45,7 +45,8 @@ 'TIMESTAMP', 'DURATION', 'ID', - 'JOINID' + 'JOINID', + 'ARGSETID' ] MACRO_ARG_TYPES = ['TABLEORSUBQUERY', 'EXPR', 'COLUMNNAME'] diff --git a/src/trace_processor/perfetto_sql/stdlib/android/input.sql b/src/trace_processor/perfetto_sql/stdlib/android/input.sql index 0c2d3ffeb2..c1f56a022a 100644 --- a/src/trace_processor/perfetto_sql/stdlib/android/input.sql +++ b/src/trace_processor/perfetto_sql/stdlib/android/input.sql @@ -300,7 +300,7 @@ CREATE PERFETTO VIEW android_key_events( -- The timestamp of when the input event was processed by the system ts TIMESTAMP, -- Details of the input event parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message @@ -325,7 +325,7 @@ CREATE PERFETTO VIEW android_motion_events( -- The timestamp of when the input event was processed by the system ts TIMESTAMP, -- Details of the input event parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message @@ -347,7 +347,7 @@ CREATE PERFETTO VIEW android_input_event_dispatch( -- Event ID of the input event that was dispatched event_id LONG, -- Details of the input event parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message diff --git a/src/trace_processor/perfetto_sql/stdlib/android/startup/startups.sql b/src/trace_processor/perfetto_sql/stdlib/android/startup/startups.sql index 9d1a7c198c..75ebbeb643 100644 --- a/src/trace_processor/perfetto_sql/stdlib/android/startup/startups.sql +++ b/src/trace_processor/perfetto_sql/stdlib/android/startup/startups.sql @@ -206,7 +206,7 @@ CREATE PERFETTO VIEW android_thread_slices_for_all_startups( -- Whether it is main thread. is_main_thread BOOL, -- Arg set id. - arg_set_id LONG, + arg_set_id ARGSETID, -- Slice id. slice_id JOINID(slice.id), -- Name of slice. @@ -254,7 +254,7 @@ RETURNS TABLE( -- Tid of the thread with the slice. tid LONG, -- Arg set id. - arg_set_id LONG + arg_set_id ARGSETID ) AS SELECT slice_id, slice_name, slice_ts, slice_dur, thread_name, tid, arg_set_id FROM android_thread_slices_for_all_startups @@ -276,7 +276,7 @@ RETURNS TABLE( -- Name of the process with slice. process STRING, -- Arg set id. - arg_set_id LONG, + arg_set_id ARGSETID, -- Whether is main thread. is_main_thread BOOL ) AS diff --git a/src/trace_processor/perfetto_sql/stdlib/android/statsd.sql b/src/trace_processor/perfetto_sql/stdlib/android/statsd.sql index 42897fa7c9..f4df40d723 100644 --- a/src/trace_processor/perfetto_sql/stdlib/android/statsd.sql +++ b/src/trace_processor/perfetto_sql/stdlib/android/statsd.sql @@ -27,7 +27,7 @@ CREATE PERFETTO VIEW android_statsd_atoms( -- The duration of the slice. dur DURATION, -- The id of the argument set associated with this slice. - arg_set_id LONG, + arg_set_id ARGSETID, -- The value of the CPU instruction counter at the start of the slice. This column will only be populated if thread instruction collection is enabled with track_event. thread_instruction_count LONG, -- The change in value of the CPU instruction counter between the start and end of the slice. This column will only be populated if thread instruction collection is enabled with track_event. diff --git a/src/trace_processor/perfetto_sql/stdlib/android/winscope/inputmethod.sql b/src/trace_processor/perfetto_sql/stdlib/android/winscope/inputmethod.sql index 55e88af6f9..8aecbbc15f 100644 --- a/src/trace_processor/perfetto_sql/stdlib/android/winscope/inputmethod.sql +++ b/src/trace_processor/perfetto_sql/stdlib/android/winscope/inputmethod.sql @@ -20,7 +20,7 @@ CREATE PERFETTO VIEW android_inputmethod_clients( -- Timestamp when the dump was triggered ts TIMESTAMP, -- Extra args parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message @@ -41,7 +41,7 @@ CREATE PERFETTO VIEW android_inputmethod_manager_service( -- Timestamp when the dump was triggered ts TIMESTAMP, -- Extra args parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message @@ -62,7 +62,7 @@ CREATE PERFETTO VIEW android_inputmethod_service( -- Timestamp when the dump was triggered ts TIMESTAMP, -- Extra args parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message diff --git a/src/trace_processor/perfetto_sql/stdlib/android/winscope/viewcapture.sql b/src/trace_processor/perfetto_sql/stdlib/android/winscope/viewcapture.sql index bcf1cb3b8b..f0c8e5846d 100644 --- a/src/trace_processor/perfetto_sql/stdlib/android/winscope/viewcapture.sql +++ b/src/trace_processor/perfetto_sql/stdlib/android/winscope/viewcapture.sql @@ -20,7 +20,7 @@ CREATE PERFETTO VIEW android_viewcapture( -- Timestamp when the snapshot was triggered ts TIMESTAMP, -- Extra args parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message diff --git a/src/trace_processor/perfetto_sql/stdlib/android/winscope/windowmanager.sql b/src/trace_processor/perfetto_sql/stdlib/android/winscope/windowmanager.sql index 55f03bff68..8cf5bc6fa4 100644 --- a/src/trace_processor/perfetto_sql/stdlib/android/winscope/windowmanager.sql +++ b/src/trace_processor/perfetto_sql/stdlib/android/winscope/windowmanager.sql @@ -20,7 +20,7 @@ CREATE PERFETTO VIEW android_windowmanager( -- Timestamp when the snapshot was triggered ts TIMESTAMP, -- Extra args parsed from the proto message - arg_set_id LONG, + arg_set_id ARGSETID, -- Raw proto message encoded in base64 base64_proto STRING, -- String id for raw proto message diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql index 2e3e24ba45..4cd0112f09 100644 --- a/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql +++ b/src/trace_processor/perfetto_sql/stdlib/chrome/scroll_jank/scroll_jank_v3_cause.sql @@ -26,7 +26,7 @@ RETURNS TABLE( -- Alias for `slice.parent_id`. parent_id LONG, -- Alias for `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias for `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias for `slice.thread_dur`. diff --git a/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql b/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql index e82c1ff4f0..31c3c0f666 100644 --- a/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql +++ b/src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql @@ -293,7 +293,7 @@ FROM slice WHERE name GLOB "Looper.dispatch: android.view.Choreographer$FrameHandler*"; -- Extract task's posted_from information from task's arguments. -CREATE PERFETTO FUNCTION _get_posted_from(arg_set_id LONG) +CREATE PERFETTO FUNCTION _get_posted_from(arg_set_id ARGSETID) RETURNS STRING AS WITH posted_from as ( SELECT @@ -400,7 +400,7 @@ CREATE PERFETTO VIEW chrome_scheduler_tasks( -- Same as slice.parent_id. parent_id LONG, -- Same as slice.arg_set_id. - arg_set_id LONG, + arg_set_id ARGSETID, -- Same as slice.thread_ts. thread_ts TIMESTAMP, -- Same as slice.thread_dur. @@ -615,7 +615,7 @@ CREATE PERFETTO VIEW chrome_tasks( -- Alias of |slice.category|. category STRING, -- Alias of |slice.arg_set_id|. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias of |slice.thread_ts|. thread_ts TIMESTAMP, -- Alias of |slice.thread_dur|. diff --git a/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/tables_views.sql b/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/tables_views.sql index ba49377de4..fcc5b3fe26 100644 --- a/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/tables_views.sql +++ b/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/tables_views.sql @@ -61,15 +61,15 @@ CREATE PERFETTO VIEW track ( -- -- Join with the `args` table or use the `EXTRACT_ARG` helper function to -- expand the args. - dimension_arg_set_id LONG, + dimension_arg_set_id ARGSETID, -- The track which is the "parent" of this track. Only non-null for tracks -- created using Perfetto's track_event API. - parent_id LONG, + parent_id JOINID(track.id), -- Generic key-value pairs containing extra information about the track. -- -- Join with the `args` table or use the `EXTRACT_ARG` helper function to -- expand the args. - source_arg_set_id LONG, + source_arg_set_id ARGSETID, -- Machine identifier, non-null for tracks on a remote machine. machine_id LONG ) AS @@ -108,7 +108,7 @@ CREATE PERFETTO VIEW cpu ( -- https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/cpu-capacity.txt capacity LONG, -- Extra key/value pairs associated with this cpu. - arg_set_id LONG + arg_set_id ARGSETID ) AS SELECT id, @@ -253,7 +253,7 @@ CREATE PERFETTO VIEW thread_state ( -- The unique thread id of the thread which caused a wakeup of this thread. waker_utid JOINID(thread.id), -- The unique thread state id which caused a wakeup of this thread. - waker_id LONG, + waker_id JOINID(thread_state.id), -- Whether the wakeup was from interrupt context or process context. irq_context LONG, -- The unique CPU identifier that the thread executed on. @@ -296,7 +296,7 @@ CREATE PERFETTO VIEW raw ( -- The thread this event was emitted on. utid JOINID(thread.id), -- The set of key/value pairs associated with this event. - arg_set_id LONG, + arg_set_id ARGSETID, -- Ftrace event flags for this event. Currently only emitted for sched_waking -- events. common_flags LONG, @@ -336,7 +336,7 @@ CREATE PERFETTO VIEW ftrace_event ( -- The thread this event was emitted on. utid JOINID(thread.id), -- The set of key/value pairs associated with this event. - arg_set_id LONG, + arg_set_id ARGSETID, -- Ftrace event flags for this event. Currently only emitted for -- sched_waking events. common_flags LONG, @@ -414,7 +414,7 @@ CREATE PERFETTO VIEW cpu_track ( -- 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. - source_arg_set_id LONG, + source_arg_set_id ARGSETID, -- Machine identifier, non-null for tracks on a remote machine. machine_id LONG, -- The CPU that the track is associated with. @@ -453,14 +453,11 @@ CREATE PERFETTO TABLE counter_track ( classification STRING, -- The dimensions of the track which uniquely identify the track within a -- given classification. - -- - -- Join with the `args` table or use the `EXTRACT_ARG` helper function to - -- expand the args. - dimension_arg_set_id LONG, + dimension_arg_set_id ARGSETID, -- 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. - source_arg_set_id LONG, + source_arg_set_id ARGSETID, -- Machine identifier, non-null for tracks on a remote machine. machine_id LONG, -- The units of the counter. This column is rarely filled. @@ -509,7 +506,7 @@ CREATE PERFETTO TABLE cpu_counter_track ( -- 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. - source_arg_set_id LONG, + source_arg_set_id ARGSETID, -- Machine identifier, non-null for tracks on a remote machine. machine_id LONG, -- The units of the counter. This column is rarely filled. diff --git a/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/views.sql b/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/views.sql index 12166f6b6c..8849bd1514 100644 --- a/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/views.sql +++ b/src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/views.sql @@ -26,7 +26,7 @@ CREATE PERFETTO VIEW counter( -- Value. value DOUBLE, -- Additional information about the counter value. - arg_set_id LONG, + arg_set_id ARGSETID, -- Legacy column, should no longer be used. type STRING ) AS @@ -67,9 +67,9 @@ CREATE PERFETTO VIEW slice( -- The stack_id for the parent of this slice. Rarely useful. parent_stack_id LONG, -- The id of the parent (i.e. immediate ancestor) slice for this slice. - parent_id LONG, + parent_id JOINID(slice.id), -- The id of the argument set associated with this slice. - arg_set_id LONG, + arg_set_id ARGSETID, -- The thread timestamp at the start of the slice. This column will only be -- populated if thread timestamp collection is enabled with track_event. thread_ts TIMESTAMP, @@ -103,7 +103,7 @@ CREATE PERFETTO VIEW instant( -- instant. name STRING, -- The id of the argument set associated with this instant. - arg_set_id LONG + arg_set_id ARGSETID ) AS SELECT ts, track_id, name, arg_set_id FROM slice @@ -134,7 +134,7 @@ CREATE PERFETTO VIEW slices( -- Alias of `slice.parent_id`. parent_id JOINID(slice.id), -- Alias of `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias of `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias of `slice.thread_dur`. @@ -217,7 +217,7 @@ CREATE PERFETTO VIEW process( -- /proc/cmdline for this process. cmdline STRING, -- Extra args for this process. - arg_set_id LONG, + arg_set_id ARGSETID, -- Machine identifier, non-null for processes on a remote machine. machine_id LONG ) AS @@ -234,7 +234,7 @@ CREATE PERFETTO VIEW args( -- The name of the "most-specific" child table containing this row. type STRING, -- The id for a single set of arguments. - arg_set_id LONG, + arg_set_id ARGSETID, -- The "flat key" of the arg: this is the key without any array indexes. flat_key STRING, -- The key for the arg. diff --git a/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql b/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql index f1dc28ab70..55a2e2ec22 100644 --- a/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql +++ b/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql @@ -19,13 +19,12 @@ -- - previous "Runnable" (or runnable preempted) state. -- - previous uninterrupted "Runnable" state with a valid waker thread. CREATE PERFETTO TABLE sched_previous_runnable_on_thread( - -- Alias of `thread_state.id`. - id LONG, - -- Previous runnable thread state. Alias of `thread_state.id`. - prev_runnable_id LONG, - -- Previous runnable thread state with valid waker thread. Alias of - -- `thread_state.id`. - prev_wakeup_runnable_id LONG + -- Running thread state + id JOINID(thread_state.id), + -- Previous runnable thread state. + prev_runnable_id JOINID(thread_state.id), + -- Previous runnable thread state with valid waker thread. + prev_wakeup_runnable_id JOINID(thread_state.id) ) AS WITH running_and_runnable AS ( SELECT diff --git a/src/trace_processor/perfetto_sql/stdlib/slices/hierarchy.sql b/src/trace_processor/perfetto_sql/stdlib/slices/hierarchy.sql index f723de2ef0..09399e3f14 100644 --- a/src/trace_processor/perfetto_sql/stdlib/slices/hierarchy.sql +++ b/src/trace_processor/perfetto_sql/stdlib/slices/hierarchy.sql @@ -38,7 +38,7 @@ RETURNS TABLE( -- Alias of `slice.parent_id`. parent_id JOINID(slice.id), -- Alias of `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias of `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias of `slice.thread_dur`. @@ -78,7 +78,7 @@ RETURNS TABLE( -- Alias of `slice.parent_id`. parent_id JOINID(slice.id), -- Alias of `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias of `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias of `slice.thread_dur`. diff --git a/src/trace_processor/perfetto_sql/stdlib/slices/slices.sql b/src/trace_processor/perfetto_sql/stdlib/slices/slices.sql index 050dc90450..7871a67e1a 100644 --- a/src/trace_processor/perfetto_sql/stdlib/slices/slices.sql +++ b/src/trace_processor/perfetto_sql/stdlib/slices/slices.sql @@ -49,9 +49,9 @@ CREATE PERFETTO VIEW _slice_with_thread_and_process_info( -- Alias for `slice.depth`. depth LONG, -- Alias for `slice.parent_id`. - parent_id LONG, + parent_id JOINID(slice.id), -- Alias for `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias for `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias for `slice.thread_dur`. diff --git a/src/trace_processor/perfetto_sql/stdlib/slices/with_context.sql b/src/trace_processor/perfetto_sql/stdlib/slices/with_context.sql index a3eeba570b..f16e667c0e 100644 --- a/src/trace_processor/perfetto_sql/stdlib/slices/with_context.sql +++ b/src/trace_processor/perfetto_sql/stdlib/slices/with_context.sql @@ -51,7 +51,7 @@ CREATE PERFETTO VIEW thread_slice( -- Alias for `slice.parent_id`. parent_id JOINID(slice.id), -- Alias for `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias for `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias for `slice.thread_dur`. @@ -113,7 +113,7 @@ CREATE PERFETTO VIEW process_slice( -- Alias for `slice.parent_id`. parent_id JOINID(slice.id), -- Alias for `slice.arg_set_id`. - arg_set_id LONG, + arg_set_id ARGSETID, -- Alias for `slice.thread_ts`. thread_ts TIMESTAMP, -- Alias for `slice.thread_dur`. diff --git a/src/trace_processor/util/sql_argument.cc b/src/trace_processor/util/sql_argument.cc index dcd78fec00..57c47e3357 100644 --- a/src/trace_processor/util/sql_argument.cc +++ b/src/trace_processor/util/sql_argument.cc @@ -35,7 +35,7 @@ std::optional ParseType(base::StringView str) { return Type::kBool; } if (str.CaseInsensitiveOneOf( - {"long", "timestamp", "duration", "id", "joinid"})) { + {"long", "timestamp", "duration", "id", "joinid", "argsetid"})) { return Type::kLong; } if (str.CaseInsensitiveEq("double")) {