• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2019 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
18DROP VIEW IF EXISTS {{table_name_prefix}}_main_thread;
19CREATE VIEW {{table_name_prefix}}_main_thread AS
20  SELECT
21    process.name as process_name,
22    thread.utid
23  FROM thread
24  JOIN {{process_allowlist_table}} process USING (upid)
25  WHERE thread.is_main_thread;
26
27DROP VIEW IF EXISTS {{table_name_prefix}}_render_thread;
28CREATE VIEW {{table_name_prefix}}_render_thread AS
29  SELECT
30    process.name as process_name,
31    thread.utid
32  FROM thread
33  JOIN {{process_allowlist_table}} process USING (upid)
34  WHERE thread.name = 'RenderThread';
35
36DROP VIEW IF EXISTS {{table_name_prefix}}_gpu_completion_thread;
37CREATE VIEW {{table_name_prefix}}_gpu_completion_thread AS
38  SELECT
39    process.name as process_name,
40    thread.utid
41  FROM thread
42  JOIN {{process_allowlist_table}} process USING (upid)
43  WHERE thread.name = 'GPU completion';
44
45DROP VIEW IF EXISTS {{table_name_prefix}}_hwc_release_thread;
46CREATE VIEW {{table_name_prefix}}_hwc_release_thread AS
47  SELECT
48    process.name as process_name,
49    thread.utid
50  FROM thread
51  JOIN {{process_allowlist_table}} process USING (upid)
52  WHERE thread.name = 'HWC release';
53
54DROP TABLE IF EXISTS {{table_name_prefix}}_main_thread_slices;
55CREATE TABLE {{table_name_prefix}}_main_thread_slices AS
56  SELECT
57    process_name,
58    thread.utid,
59    slice.*,
60    ts + dur AS ts_end
61  FROM slice
62  JOIN thread_track ON slice.track_id = thread_track.id
63  JOIN {{table_name_prefix}}_main_thread thread USING (utid)
64  WHERE dur > 0;
65
66DROP VIEW IF EXISTS {{table_name_prefix}}_do_frame_slices;
67CREATE VIEW {{table_name_prefix}}_do_frame_slices AS
68  SELECT
69    *,
70    CAST(STR_SPLIT(name, ' ', 1) AS INTEGER) as vsync
71  FROM {{table_name_prefix}}_main_thread_slices
72  WHERE name LIKE 'Choreographer#doFrame%';
73
74DROP TABLE IF EXISTS {{table_name_prefix}}_render_thread_slices;
75CREATE TABLE {{table_name_prefix}}_render_thread_slices AS
76  SELECT
77    process_name,
78    thread.utid,
79    slice.*,
80    ts + dur AS ts_end
81  FROM slice
82  JOIN thread_track ON slice.track_id = thread_track.id
83  JOIN {{table_name_prefix}}_render_thread thread USING (utid)
84  WHERE dur > 0;
85
86DROP VIEW IF EXISTS {{table_name_prefix}}_draw_frame_slices;
87CREATE VIEW {{table_name_prefix}}_draw_frame_slices AS
88  SELECT
89    *,
90    CAST(STR_SPLIT(name, ' ', 1) AS INTEGER) as vsync
91  FROM {{table_name_prefix}}_render_thread_slices
92  WHERE name LIKE 'DrawFrame%';
93
94DROP VIEW IF EXISTS {{table_name_prefix}}_gpu_completion_slices;
95CREATE VIEW {{table_name_prefix}}_gpu_completion_slices AS
96  SELECT
97    process_name,
98    thread.utid,
99    slice.*,
100    ts + dur AS ts_end,
101    -- Extracts 1234 from 'waiting for GPU completion 1234'
102    CAST(STR_SPLIT(slice.name, ' ', 4) AS INTEGER) as idx
103  FROM slice
104  JOIN thread_track ON slice.track_id = thread_track.id
105  JOIN {{table_name_prefix}}_gpu_completion_thread thread USING (utid)
106  WHERE slice.name LIKE 'waiting for GPU completion %'
107  AND dur > 0;
108
109DROP VIEW IF EXISTS {{table_name_prefix}}_hwc_release_slices;
110CREATE VIEW {{table_name_prefix}}_hwc_release_slices AS
111  SELECT
112    process_name,
113    thread.utid,
114    slice.*,
115    ts + dur as ts_end,
116    -- Extracts 1234 from 'waiting for HWC release 1234'
117    CAST(STR_SPLIT(slice.name, ' ', 4) AS INTEGER) as idx
118  FROM slice
119  JOIN thread_track ON slice.track_id = thread_track.id
120  JOIN {{table_name_prefix}}_hwc_release_thread thread USING (utid)
121  WHERE slice.name LIKE 'waiting for HWC release %'
122  AND dur > 0;
123