diff --git a/python/generators/sql_processing/utils.py b/python/generators/sql_processing/utils.py index 19d4d39258..097537e5f5 100644 --- a/python/generators/sql_processing/utils.py +++ b/python/generators/sql_processing/utils.py @@ -43,7 +43,8 @@ # Special types 'TIMESTAMP', - 'DURATION' + 'DURATION', + 'ID' ] MACRO_ARG_TYPES = ['TABLEORSUBQUERY', 'EXPR', 'COLUMNNAME'] 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 f688925f01..777e2a410f 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 @@ -41,7 +41,7 @@ SELECT start_ts, end_ts FROM _trace_bounds; CREATE PERFETTO VIEW track ( -- Unique identifier for this track. Identical to |track_id|, prefer using -- |track_id| instead. - id LONG, + id ID, -- 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 @@ -88,10 +88,10 @@ FROM __intrinsic_track; CREATE PERFETTO VIEW cpu ( -- Unique identifier for this CPU. Identical to |ucpu|, prefer using |ucpu| -- instead. - id LONG, + id ID, -- Unique identifier for this CPU. Isn't equal to |cpu| for remote machines -- and is equal to |cpu| for the host machine. - ucpu LONG, + ucpu ID, -- The 0-based CPU core identifier. cpu LONG, -- The name of the "most-specific" child table containing this row. @@ -129,7 +129,7 @@ WHERE -- running at. CREATE PERFETTO VIEW cpu_available_frequencies ( -- Unique identifier for this cpu frequency. - id LONG, + id ID, -- The CPU for this frequency, meaningful only in single machine traces. -- For multi-machine, join with the `cpu` table on `ucpu` to get the CPU -- identifier of each machine. @@ -157,7 +157,7 @@ FROM -- table with |thread_state.state| = 'Running' CREATE PERFETTO VIEW sched_slice ( -- Unique identifier for this scheduling slice. - id LONG, + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- The timestamp at the start of the slice. @@ -230,7 +230,7 @@ FROM sched_slice; -- corresponding row in the |sched_slice| table. CREATE PERFETTO VIEW thread_state ( -- Unique identifier for this thread state. - id LONG, + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- The timestamp at the start of the slice. @@ -281,7 +281,7 @@ FROM -- usecases (i.e. metrics, standard library etc.) CREATE PERFETTO VIEW raw ( -- Unique identifier for this raw event. - id LONG, + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- The timestamp of this event. @@ -322,7 +322,7 @@ FROM -- raw ftrace parsing has been disabled. CREATE PERFETTO VIEW ftrace_event ( -- Unique identifier for this ftrace event. - id LONG, + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- The timestamp of this event. @@ -358,8 +358,8 @@ FROM -- The sched_slice table with the upid column. CREATE PERFETTO VIEW experimental_sched_upid ( - -- Unique identifier for this scheduling slice. - id LONG, + -- Unique identifier for this scheduling slice. + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- The timestamp at the start of the slice. @@ -403,7 +403,7 @@ FROM -- Tracks which are associated to a single CPU. CREATE PERFETTO VIEW cpu_track ( -- Unique identifier for this cpu track. - id LONG, + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- Name of the track. @@ -439,7 +439,7 @@ FROM -- Tracks containing counter-like events associated to a CPU. CREATE PERFETTO VIEW cpu_counter_track ( -- Unique identifier for this cpu counter track. - id LONG, + id ID, -- The name of the "most-specific" child table containing this row. type STRING, -- Name of the track. diff --git a/src/trace_processor/util/sql_argument.cc b/src/trace_processor/util/sql_argument.cc index 543c018354..e24a3af774 100644 --- a/src/trace_processor/util/sql_argument.cc +++ b/src/trace_processor/util/sql_argument.cc @@ -34,7 +34,7 @@ std::optional ParseType(base::StringView str) { if (str.CaseInsensitiveEq("bool")) { return Type::kBool; } - if (str.CaseInsensitiveOneOf({"long", "timestamp", "duration"})) { + if (str.CaseInsensitiveOneOf({"long", "timestamp", "duration", "id"})) { return Type::kLong; } if (str.CaseInsensitiveEq("double")) {