• 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 LONG,
23  -- The timestamp at the start of the slice.
24  ts TIMESTAMP,
25  -- The duration of the slice.
26  dur DURATION,
27  -- The id of the argument set associated with this slice.
28  arg_set_id ARGSETID,
29  -- 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.
30  thread_instruction_count LONG,
31  -- 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.
32  thread_instruction_delta LONG,
33  -- The id of the track this slice is located on.
34  track_id JOINID(track.id),
35  -- 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).
36  category STRING,
37  -- The name of the slice. The name describes what was happening during the slice.
38  name STRING,
39  -- The depth of the slice in the current stack of slices.
40  depth LONG,
41  -- A unique identifier obtained from the names of all slices in this stack. This is rarely useful and kept around only for legacy reasons.
42  stack_id LONG,
43  -- The stack_id for the parent of this slice. Rarely useful.
44  parent_stack_id LONG,
45  -- The id of the parent (i.e. immediate ancestor) slice for this slice.
46  parent_id LONG,
47  -- The thread timestamp at the start of the slice. This column will only be populated if thread timestamp collection is enabled with track_event.
48  thread_ts TIMESTAMP,
49  -- The thread time used by this slice. This column will only be populated if thread timestamp collection is enabled with track_event.
50  thread_dur LONG
51) AS
52SELECT
53  slice.id AS id,
54  slice.ts AS ts,
55  slice.dur AS dur,
56  slice.arg_set_id AS arg_set_id,
57  slice.thread_instruction_count AS thread_instruction_count,
58  slice.thread_instruction_delta AS thread_instruction_delta,
59  slice.track_id AS track_id,
60  slice.category AS category,
61  slice.name AS name,
62  slice.depth AS depth,
63  slice.stack_id AS stack_id,
64  slice.parent_stack_id AS parent_stack_id,
65  slice.parent_id AS parent_id,
66  slice.thread_ts AS thread_ts,
67  slice.thread_dur AS thread_dur
68FROM slice
69JOIN track
70  ON slice.track_id = track.id
71WHERE
72  track.name = 'Statsd Atoms';
73
74-- Information about Perfetto triggers, extracted from statsd atoms, which
75-- happened during the trace.
76--
77-- This requires the `android.statsd` data-source to be enabled and the
78-- `ATOM_PERFETTO_TRIGGER` push atom to be configured.
79CREATE PERFETTO TABLE _android_statsd_perfetto_triggers (
80  -- Timestamp of the trigger.
81  ts TIMESTAMP,
82  -- The name of the trigger.
83  trigger_name STRING
84) AS
85SELECT
86  ts,
87  extract_arg(arg_set_id, 'perfetto_trigger.trigger_name') AS trigger_name
88FROM android_statsd_atoms
89WHERE
90  name = 'perfetto_trigger';
91