• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2024 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
16INCLUDE PERFETTO MODULE android.process_metadata;
17
18-- Establish relationships between thread and process
19CREATE PERFETTO TABLE _thread_process_summary AS
20SELECT
21  thread.utid,
22  thread.upid,
23  thread.tid,
24  process.pid,
25  thread.name AS thread_name,
26  process.name AS process_name
27FROM thread
28LEFT JOIN process
29  USING (upid);
30
31-- Add thread_state info to thread/process/package
32CREATE PERFETTO TABLE _state_w_thread_process_summary AS
33SELECT
34  thread_state.ts,
35  thread_state.dur,
36  thread_state.cpu,
37  thread_state.state,
38  m.utid,
39  m.upid,
40  m.tid,
41  m.pid,
42  m.thread_name,
43  m.process_name
44FROM _thread_process_summary AS m
45JOIN thread_state
46  USING (utid);
47
48-- Add scheduling slices info to thread/process/package
49CREATE PERFETTO TABLE _sched_w_thread_process_package_summary AS
50SELECT
51  sched.ts,
52  sched.dur,
53  sched.cpu,
54  m.utid,
55  m.upid,
56  m.tid,
57  m.pid,
58  package.uid,
59  m.thread_name,
60  m.process_name,
61  package.package_name
62FROM _thread_process_summary AS m
63JOIN sched
64  USING (utid)
65LEFT JOIN android_process_metadata AS package
66  USING (upid)
67WHERE
68  dur > 0;
69