• 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--
16
17INCLUDE PERFETTO MODULE android.app_process_starts;
18INCLUDE PERFETTO MODULE android.garbage_collection;
19INCLUDE PERFETTO MODULE android.suspend;
20
21DROP VIEW IF EXISTS android_boot_unagg_output;
22CREATE PERFETTO VIEW android_boot_unagg_output AS
23SELECT AndroidBootUnagg(
24  'android_app_process_start_metric', (
25    SELECT AndroidAppProcessStartsMetric(
26        'all_apps', (
27            SELECT RepeatedField(
28                AndroidAppProcessStartsMetric_ProcessStart(
29                    'process_name', process_name,
30                    'intent', intent,
31                    'reason', reason,
32                    'proc_start_dur', proc_start_dur,
33                    'bind_app_dur', bind_app_dur,
34                    'intent_dur', intent_dur,
35                    'total_dur', total_dur
36                )
37            )
38            FROM android_app_process_starts WHERE proc_start_ts > (SELECT COALESCE(MIN(ts), 0)
39            FROM thread_slice WHERE name GLOB "*android.intent.action.USER_UNLOCKED*" ORDER BY ts
40            ASC LIMIT 1)
41        ),
42        'started_by_broadcast', (
43            SELECT RepeatedField(
44                AndroidAppProcessStartsMetric_ProcessStart(
45                    'process_name', process_name,
46                    'intent', intent,
47                    'reason', reason,
48                    'proc_start_dur', proc_start_dur,
49                    'bind_app_dur', bind_app_dur,
50                    'intent_dur', intent_dur,
51                    'total_dur', total_dur
52                )
53            )
54            FROM android_app_process_starts WHERE proc_start_ts > (SELECT COALESCE(MIN(ts), 0)
55            FROM thread_slice WHERE name GLOB "*android.intent.action.USER_UNLOCKED*" ORDER BY ts
56            ASC LIMIT 1)
57            AND reason = "broadcast"
58        ),
59        'started_by_service', (
60            SELECT RepeatedField(
61                AndroidAppProcessStartsMetric_ProcessStart(
62                    'process_name', process_name,
63                    'intent', intent,
64                    'reason', reason,
65                    'proc_start_dur', proc_start_dur,
66                    'bind_app_dur', bind_app_dur,
67                    'intent_dur', intent_dur,
68                    'total_dur', total_dur
69                )
70            )
71            FROM android_app_process_starts WHERE proc_start_ts > (SELECT COALESCE(MIN(ts), 0)
72            FROM thread_slice WHERE name GLOB "*android.intent.action.USER_UNLOCKED*" ORDER BY ts
73            ASC LIMIT 1 )
74            AND reason = "service"
75        )
76    )),
77    'android_post_boot_gc_metric', (SELECT AndroidGarbageCollectionUnaggMetric(
78        'gc_events', (
79            SELECT RepeatedField(
80                AndroidGarbageCollectionUnaggMetric_GarbageCollectionEvent(
81                    'thread_name', thread_name,
82                    'process_name', process_name,
83                    'gc_type', gc_type,
84                    'is_mark_compact', is_mark_compact,
85                    'reclaimed_mb', reclaimed_mb,
86                    'min_heap_mb', min_heap_mb,
87                    'max_heap_mb', max_heap_mb,
88                    'mb_per_ms_of_running_gc', reclaimed_mb/(gc_running_dur/1e6),
89                    'mb_per_ms_of_wall_gc', reclaimed_mb/(gc_dur/1e6),
90                    'gc_dur', gc_dur,
91                    'gc_running_dur', gc_running_dur,
92                    'gc_runnable_dur', gc_runnable_dur,
93                    'gc_unint_io_dur', gc_unint_io_dur,
94                    'gc_unint_non_io_dur', gc_unint_non_io_dur,
95                    'gc_int_dur', gc_int_dur,
96                    'gc_ts', gc_ts,
97                    'tid', tid,
98                    'pid', pid,
99                    'gc_monotonic_dur', _extract_duration_without_suspend(gc_ts, gc_dur)
100                )
101            ) FROM android_garbage_collection_events WHERE gc_ts > (SELECT COALESCE(MIN(ts), 0)
102                FROM thread_slice WHERE name GLOB "*android.intent.action.USER_UNLOCKED*" ORDER BY ts
103                ASC LIMIT 1
104            )
105        )
106    ))
107);
108