• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 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 *      http://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
17syntax = "proto2";
18
19package perfetto.protos;
20
21import "protos/perfetto/metrics/android/process_metadata.proto";
22
23// Android app startup metrics.
24message AndroidStartupMetric {
25  // A simplified view of the task state durations for a thread
26  // and a span of time.
27  message TaskStateBreakdown {
28    optional int64 running_dur_ns = 1;
29    optional int64 runnable_dur_ns = 2;
30    optional int64 uninterruptible_sleep_dur_ns = 3;
31    optional int64 interruptible_sleep_dur_ns = 4;
32  }
33
34  message McyclesByCoreType {
35    optional int64 little = 1;
36    optional int64 big = 2;
37    optional int64 bigger = 3;
38    optional int64 unknown = 4;
39  }
40
41  message Slice {
42    optional int64 dur_ns = 1;
43    optional double dur_ms = 2;
44  }
45
46  // Timing information spanning the intent received by the
47  // activity manager to the first frame drawn.
48  // Next id: 31.
49  message ToFirstFrame {
50    // The duration between the intent received and first frame.
51    optional int64 dur_ns = 1;
52    optional double dur_ms = 17;
53
54    // Breakdown of time to first frame by task state for the main thread of
55    // the process starting up.
56    optional TaskStateBreakdown main_thread_by_task_state = 2;
57
58    // The mcycles taken by this startup across all CPUs (broken down by core
59    // type).
60    optional McyclesByCoreType mcycles_by_core_type = 26;
61
62    // In this timespan, how many processes (apart from the main activity) were
63    // spawned.
64    optional uint32 other_processes_spawned_count = 3;
65
66    // Total time spent in activity manager between the initial intent
67    // and the end of the activity starter.
68    optional Slice time_activity_manager = 4;
69
70    // The following slices follow the typical steps post-fork.
71    optional Slice time_activity_thread_main = 5;
72    optional Slice time_bind_application = 6;
73    optional Slice time_activity_start = 7;
74    optional Slice time_activity_resume = 8;
75    optional Slice time_activity_restart = 21;
76    optional Slice time_choreographer = 9;
77    optional Slice time_inflate = 22;
78    optional Slice time_get_resources = 23;
79
80    // If we are starting a new process, record the duration from the
81    // intent being received to the time we call the zygote.
82    optional Slice time_before_start_process = 10;
83
84    // The actual duration of the process start (based on the zygote slice).
85    optional Slice time_during_start_process = 11;
86
87    optional Slice to_post_fork = 18;
88    optional Slice to_activity_thread_main = 19;
89    optional Slice to_bind_application = 20;
90
91    optional Slice time_post_fork = 16;
92
93    // The total time spent on opening dex files.
94    optional Slice time_dex_open = 24;
95    // Total time spent verifying classes during app startup.
96    optional Slice time_verify_class = 25;
97
98    // Number of methods that were compiled by JIT during app startup.
99    optional uint32 jit_compiled_methods = 27;
100
101    // Time spent running CPU on jit thread pool.
102    optional Slice time_jit_thread_pool_on_cpu = 28;
103
104    // Time spent on garbage collection.
105    optional Slice time_gc_total = 29;
106    optional Slice time_gc_on_cpu = 30;
107    // Deprecated was other_process_to_activity_cpu_ratio
108    reserved 12;
109
110    // Removed: was uint32 versions of to_post_fork, to_activity_thread_main and
111    // to_bind_application.
112    reserved 13, 14, 15;
113  }
114
115  // Metrics about startup which were developed by looking at experiments using
116  // high-speed cameras (HSC).
117  message HscMetrics {
118    // The duration of the full "startup" as defined by HSC tests.
119    optional Slice full_startup = 1;
120  }
121
122  message Activity {
123    optional string name = 1;
124    optional string method = 2;
125    optional int64 ts_method_start = 4;
126
127    // Field 3 contained Slice with a sum of durations for matching slices.
128    reserved 3;
129  }
130
131  message BinderTransaction {
132    optional Slice duration = 1;
133    optional string thread = 2;
134    optional string destination_thread = 3;
135    optional string destination_process = 4;
136    // From
137    // https://cs.android.com/android/platform/superproject/+/master:external/perfetto/protos/perfetto/trace/ftrace/binder.proto;l=15;drc=7b6a788162a30802f4c9d8d7a30a54e25edd30f1
138    optional string flags = 5;
139    // From
140    // https://cs.android.com/android/platform/superproject/+/master:external/perfetto/protos/perfetto/trace/ftrace/binder.proto;l=14;drc=7b6a788162a30802f4c9d8d7a30a54e25edd30f1
141    optional string code = 6;
142    // From
143    // https://cs.android.com/android/platform/superproject/+/master:external/perfetto/protos/perfetto/trace/ftrace/binder.proto;l=37;drc=7b6a788162a30802f4c9d8d7a30a54e25edd30f1
144    optional int64 data_size = 7;
145  }
146
147  // Metrics with information about the status of odex files and the outcome
148  // of the loading process.
149  // Multiple files might be loaded for a single startup. Platform might also
150  // decide to discard an odex file and instead load a fallback, for example
151  // in case the OS or apk were updated.
152  message OptimizationStatus {
153    optional string odex_status = 1;
154    optional string compilation_filter = 2;
155    optional string compilation_reason = 3;
156    optional string location = 4;
157  }
158
159  // Contains timestamps of important events which occurred during the
160  // startup.
161  message EventTimestamps {
162    optional int64 intent_received = 1;
163    optional int64 first_frame = 2;
164  }
165
166  // Next id: 15
167  message Startup {
168    // Random id uniquely identifying an app startup in this trace.
169    optional uint32 startup_id = 1;
170
171    // Name of the package launched
172    optional string package_name = 2;
173
174    // Name of the process launched
175    optional string process_name = 3;
176
177    // Details about the activities launched
178    repeated Activity activities = 11;
179
180    // Details about slow binder transactions during the startup. The definition
181    // of a slow transaction is an implementation detail.
182    repeated BinderTransaction long_binder_transactions = 14;
183
184    // Did we ask the zygote for a new process
185    optional bool zygote_new_process = 4;
186
187    // Number of processes hosting the activity involved in the launch.
188    // This will usually be 1. If it is 0, it is indicative of a data / process
189    // error. If > 1, the process died during startup and the system respawned
190    // it.
191    optional uint32 activity_hosting_process_count = 6;
192
193    // Contains timestamps of important events which happened during
194    // the startup.
195    optional EventTimestamps event_timestamps = 13;
196
197    // Timing information spanning the intent received by the
198    // activity manager to the first frame drawn.
199    optional ToFirstFrame to_first_frame = 5;
200
201    // Details about the process (uid, version, etc)
202    optional AndroidProcessMetadata process = 7;
203
204    // Metrics about startup which were developed by looking at experiments
205    // using high-speed cameras (HSC).
206    optional HscMetrics hsc = 8;
207
208    // The time taken in the startup from intent recieved to the start time
209    // of the reportFullyDrawn slice. This should be longer than the time to
210    // first frame as the application decides this after it starts rendering.
211    optional Slice report_fully_drawn = 9;
212
213    // Conntains information about the status of odex files.
214    repeated OptimizationStatus optimization_status = 12;
215
216    reserved 10;
217  }
218
219  repeated Startup startup = 1;
220}
221