• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2023 The Android Open Source Project
3--
4-- Licensed under the Apache License, Version 2.0 (the "License");
5-- you may not use this file except in compliance with the License.
6-- You may obtain a copy of the License at
7--
8--     https://www.apache.org/licenses/LICENSE-2.0
9--
10-- Unless required by applicable law or agreed to in writing, software
11-- distributed under the License is distributed on an "AS IS" BASIS,
12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-- See the License for the specific language governing permissions and
14-- limitations under the License.
15--
16
17-- Statsd atoms.
18--
19-- A subset of the slice table containing statsd atom instant events.
20CREATE PERFETTO VIEW android_statsd_atoms(
21  -- Unique identifier for this slice.
22  id INT,
23  -- The name of the "most-specific" child table containing this row.
24  type STRING,
25  -- The timestamp at the start of the slice (in nanoseconds).
26  ts INT,
27  -- The duration of the slice (in nanoseconds).
28  dur INT,
29  -- The id of the argument set associated with this slice.
30  arg_set_id INT,
31  -- 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.
32  thread_instruction_count INT,
33  -- 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.
34  thread_instruction_delta INT,
35  -- The id of the track this slice is located on.
36  track_id INT,
37  -- The "category" of the slice. If this slice originated with track_event, this column contains the category emitted. Otherwise, it is likely to be null (with limited exceptions).
38  category STRING,
39  -- The name of the slice. The name describes what was happening during the slice.
40  name STRING,
41  -- The depth of the slice in the current stack of slices.
42  depth INT,
43  -- A unique identifier obtained from the names of all slices in this stack. This is rarely useful and kept around only for legacy reasons.
44  stack_id INT,
45  -- The stack_id for the parent of this slice. Rarely useful.
46  parent_stack_id INT,
47  -- The id of the parent (i.e. immediate ancestor) slice for this slice.
48  parent_id INT,
49  -- The thread timestamp at the start of the slice. This column will only be populated if thread timestamp collection is enabled with track_event.
50  thread_ts INT,
51  -- The thread time used by this slice. This column will only be populated if thread timestamp collection is enabled with track_event.
52  thread_dur INT
53) AS
54SELECT
55  slice.id AS id,
56  slice.type AS type,
57  slice.ts AS ts,
58  slice.dur AS dur,
59  slice.arg_set_id AS arg_set_id,
60  slice.thread_instruction_count AS thread_instruction_count,
61  slice.thread_instruction_delta AS thread_instruction_delta,
62  slice.track_id AS track_id,
63  slice.category AS category,
64  slice.name AS name,
65  slice.depth AS depth,
66  slice.stack_id AS stack_id,
67  slice.parent_stack_id AS parent_stack_id,
68  slice.parent_id AS parent_id,
69  slice.thread_ts AS thread_ts,
70  slice.thread_dur AS thread_dur
71FROM slice
72JOIN track ON slice.track_id = track.id
73WHERE
74  track.name = 'Statsd Atoms';
75
76-- Information about Perfetto triggers, extracted from statsd atoms, which
77-- happened during the trace.
78--
79-- This requires the `android.statsd` data-source to be enabled and the
80-- `ATOM_PERFETTO_TRIGGER` push atom to be configured.
81CREATE PERFETTO TABLE _android_statsd_perfetto_triggers(
82  -- Timestamp of the trigger.
83  ts INT,
84  -- The name of the trigger.
85  trigger_name STRING
86)
87AS
88SELECT
89  ts,
90  extract_arg(arg_set_id, 'perfetto_trigger.trigger_name') AS trigger_name
91FROM android_statsd_atoms
92WHERE name = 'perfetto_trigger';
93