blob: 5ad13fc58a38ca2f0ce72bd8aea7105ee39c17ab [file] [log] [blame]
Nan Zhang17f27672018-12-12 16:01:49 -08001// Copyright 2018 Google Inc. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto2";
16
Patrice Arruda0cc5b212019-06-14 15:27:46 -070017package soong_build_metrics;
Dan Willemsen4591b642021-05-24 14:24:12 -070018option go_package = "android/soong/ui/metrics/metrics_proto";
Nan Zhang17f27672018-12-12 16:01:49 -080019
20message MetricsBase {
21 // Timestamp generated when the build starts.
22 optional int64 build_date_timestamp = 1;
23
24 // It is usually used to specify the branch name [and release candidate].
25 optional string build_id = 2;
26
27 // The platform version codename, eg. P, Q, REL.
28 optional string platform_version_codename = 3;
29
30 // The target product information, eg. aosp_arm.
31 optional string target_product = 4;
32
Patrice Arruda0cc5b212019-06-14 15:27:46 -070033 enum BuildVariant {
Nan Zhang17f27672018-12-12 16:01:49 -080034 USER = 0;
35 USERDEBUG = 1;
36 ENG = 2;
37 }
38 // The target build variant information, eg. eng.
Patrice Arruda0cc5b212019-06-14 15:27:46 -070039 optional BuildVariant target_build_variant = 5 [default = ENG];
Nan Zhang17f27672018-12-12 16:01:49 -080040
Patrice Arruda0cc5b212019-06-14 15:27:46 -070041 enum Arch {
Nan Zhang17f27672018-12-12 16:01:49 -080042 UNKNOWN = 0;
43 ARM = 1;
44 ARM64 = 2;
45 X86 = 3;
46 X86_64 = 4;
47 }
48 // The target arch information, eg. arm.
Patrice Arruda0cc5b212019-06-14 15:27:46 -070049 optional Arch target_arch = 6 [default = UNKNOWN];
Nan Zhang17f27672018-12-12 16:01:49 -080050
51 // The target arch variant information, eg. armv7-a-neon.
52 optional string target_arch_variant = 7;
53
54 // The target cpu variant information, eg. generic.
55 optional string target_cpu_variant = 8;
56
57 // The host arch information, eg. x86_64.
Patrice Arruda0cc5b212019-06-14 15:27:46 -070058 optional Arch host_arch = 9 [default = UNKNOWN];
Nan Zhang17f27672018-12-12 16:01:49 -080059
60 // The host 2nd arch information, eg. x86.
Patrice Arruda0cc5b212019-06-14 15:27:46 -070061 optional Arch host_2nd_arch = 10 [default = UNKNOWN];
Nan Zhang17f27672018-12-12 16:01:49 -080062
63 // The host os information, eg. linux.
64 optional string host_os = 11;
65
66 // The host os extra information, eg. Linux-4.17.0-3rodete2-amd64-x86_64-Debian-GNU.
67 optional string host_os_extra = 12;
68
69 // The host cross os information, eg. windows.
70 optional string host_cross_os = 13;
71
72 // The host cross arch information, eg. x86.
73 optional string host_cross_arch = 14;
74
75 // The host cross 2nd arch information, eg. x86_64.
76 optional string host_cross_2nd_arch = 15;
77
78 // The directory for generated built artifacts installation, eg. out.
79 optional string out_dir = 16;
80
81 // The metrics for calling various tools (microfactory) before Soong_UI starts.
82 repeated PerfInfo setup_tools = 17;
83
84 // The metrics for calling Kati by multiple times.
85 repeated PerfInfo kati_runs = 18;
86
87 // The metrics for calling Soong.
88 repeated PerfInfo soong_runs = 19;
89
90 // The metrics for calling Ninja.
91 repeated PerfInfo ninja_runs = 20;
Colin Cross74cda722020-01-16 15:25:50 -080092
93 // The metrics for the whole build
94 optional PerfInfo total = 21;
Colin Crossb72c9092020-02-10 11:23:49 -080095
Jason Wu41886f22023-01-04 11:29:36 -050096 // Deprecated because instead of embedding in a MetricsBase, we keep
97 // SoongBuildMetrics in its own file
98 optional SoongBuildMetrics soong_build_metrics = 22 [deprecated=true];
Patrice Arruda96850362020-08-11 20:41:11 +000099
100 optional BuildConfig build_config = 23;
Patrice Arruda4fb8adc2020-10-12 22:38:06 +0000101
102 // The hostname of the machine.
103 optional string hostname = 24;
Patrice Arruda3edfd482020-10-13 23:58:41 +0000104
105 // The system resource information such as total physical memory.
106 optional SystemResourceInfo system_resource_info = 25;
Patrice Arrudae92c30d2020-10-29 11:01:32 -0700107
108 // The build command that the user entered to the build system.
109 optional string build_command = 26;
Patrice Arrudab7cf9ba2020-11-13 13:04:17 -0800110
111 // The metrics for calling Bazel.
112 repeated PerfInfo bazel_runs = 27;
David Goldsmith62243a32022-04-08 13:42:04 +0000113
114 // The metrics of the experiment config fetcher
115 optional ExpConfigFetcher exp_config_fetcher = 28;
Liz Kammerf2a80c62022-10-21 10:42:35 -0400116
117 // Whether the build exited with a panic or non-zero exit code, includes both
118 // non-zero exits of recorded phases and non-recorded phases of the build.
119 optional bool non_zero_exit = 29;
120
121 // The error message due to a non-zero exit _only_ if it did not occur in a
122 // recorded phase of the build.
123 optional string error_message = 30;
Patrice Arruda96850362020-08-11 20:41:11 +0000124}
125
126message BuildConfig {
127 optional bool use_goma = 1;
128
129 optional bool use_rbe = 2;
Patrice Arrudac97d6dc2020-09-28 18:22:07 +0000130
131 optional bool force_use_goma = 3;
Liz Kammerca9cb2e2021-07-14 15:29:57 -0400132
133 // Whether the Bazel is acting as the Ninja executor for this build.
134 optional bool bazel_as_ninja = 4;
135
136 // Whether build is occurring in a mixed build mode, where Bazel maintains the
137 // definition and build of some modules in cooperation with Soong.
138 optional bool bazel_mixed_build = 5;
Yu Liue737a992021-10-04 13:21:41 -0700139
140 // These are the targets soong passes to ninja, these targets include special
141 // targets such as droid as well as the regular build targets.
142 repeated string targets = 6;
Romain Jobredeauxea098ef2022-10-20 14:24:31 -0400143
144 // Whether the user explicitly disabled bazel mixed builds for this build.
145 optional bool force_disable_bazel_mixed_build = 7;
Nan Zhang17f27672018-12-12 16:01:49 -0800146}
147
Patrice Arruda3edfd482020-10-13 23:58:41 +0000148message SystemResourceInfo {
149 // The total physical memory in bytes.
150 optional uint64 total_physical_memory = 1;
151
152 // The total of available cores for building
153 optional int32 available_cpus = 2;
154}
155
Nan Zhang17f27672018-12-12 16:01:49 -0800156message PerfInfo {
157 // The description for the phase/action/part while the tool running.
Yu Liu37c3dd32021-09-30 14:46:18 -0700158 optional string description = 1;
Nan Zhang17f27672018-12-12 16:01:49 -0800159
160 // The name for the running phase/action/part.
161 optional string name = 2;
162
163 // The absolute start time.
164 // The number of nanoseconds elapsed since January 1, 1970 UTC.
165 optional uint64 start_time = 3;
166
167 // The real running time.
168 // The number of nanoseconds elapsed since start_time.
169 optional uint64 real_time = 4;
170
Patrice Arrudafec3bf22020-10-19 10:55:34 -0700171 // The number of MB for memory use (deprecated as it is too generic).
172 optional uint64 memory_use = 5 [deprecated=true];
173
174 // The resource information of each executed process.
175 repeated ProcessResourceInfo processes_resource_info = 6;
Liz Kammerf2a80c62022-10-21 10:42:35 -0400176
177 // Whether the phase of tool running exited with a panic or non-zero exit
178 // code.
179 optional bool non_zero_exit = 7;
180
181 // The error message, if any, due to a non-zero exit.
182 optional string error_message = 8;
Patrice Arrudafec3bf22020-10-19 10:55:34 -0700183}
184
185message ProcessResourceInfo {
186 // The name of the process for identification.
187 optional string name = 1;
188
189 // The amount of time spent executing in user space in microseconds.
190 optional uint64 user_time_micros = 2;
191
192 // The amount of time spent executing in kernel mode in microseconds.
193 optional uint64 system_time_micros = 3;
194
195 // The maximum resident set size memory used in kilobytes.
196 optional uint64 max_rss_kb = 4;
197
198 // The number of minor page faults serviced without any I/O activity.
199 optional uint64 minor_page_faults = 5;
200
201 // The number of major page faults serviced that required I/O activity.
202 optional uint64 major_page_faults = 6;
203
204 // Total IO input in kilobytes.
205 optional uint64 io_input_kb= 7;
206
207 // Total IO output in kilobytes.
208 optional uint64 io_output_kb = 8;
209
210 // The number of voluntary context switches
211 optional uint64 voluntary_context_switches = 9;
212
213 // The number of involuntary context switches
214 optional uint64 involuntary_context_switches = 10;
Nan Zhang17f27672018-12-12 16:01:49 -0800215}
216
217message ModuleTypeInfo {
Patrice Arruda0cc5b212019-06-14 15:27:46 -0700218 enum BuildSystem {
Nan Zhang17f27672018-12-12 16:01:49 -0800219 UNKNOWN = 0;
220 SOONG = 1;
221 MAKE = 2;
222 }
MarkDacekff851b82022-04-21 18:33:17 +0000223 // The build system, e.g. Soong or Make.
Patrice Arruda0cc5b212019-06-14 15:27:46 -0700224 optional BuildSystem build_system = 1 [default = UNKNOWN];
Nan Zhang17f27672018-12-12 16:01:49 -0800225
MarkDacekff851b82022-04-21 18:33:17 +0000226 // The module type, e.g. java_library, cc_binary, and etc.
Nan Zhang17f27672018-12-12 16:01:49 -0800227 optional string module_type = 2;
228
229 // The number of logical modules.
230 optional uint32 num_of_modules = 3;
231}
Colin Crossd0be2102019-11-26 16:16:57 -0800232
233message CriticalUserJourneyMetrics {
234 // The name of a critical user journey test.
235 optional string name = 1;
236
237 // The metrics produced when running the critical user journey test.
238 optional MetricsBase metrics = 2;
239}
240
241message CriticalUserJourneysMetrics {
242 // A set of metrics from a run of the critical user journey tests.
243 repeated CriticalUserJourneyMetrics cujs = 1;
Colin Crossb72c9092020-02-10 11:23:49 -0800244}
245
246message SoongBuildMetrics {
247 // The number of modules handled by soong_build.
248 optional uint32 modules = 1;
249
250 // The total number of variants handled by soong_build.
251 optional uint32 variants = 2;
252
253 // The total number of allocations in soong_build.
254 optional uint64 total_alloc_count = 3;
255
256 // The total size of allocations in soong_build in bytes.
257 optional uint64 total_alloc_size = 4;
258
259 // The approximate maximum size of the heap in soong_build in bytes.
260 optional uint64 max_heap_size = 5;
Chris Parsons715b08f2022-03-22 19:23:40 -0400261
262 // Runtime metrics for soong_build execution.
263 repeated PerfInfo events = 6;
MarkDacekff851b82022-04-21 18:33:17 +0000264
265 // Mixed Builds information
266 optional MixedBuildsInfo mixed_builds_info = 7;
Patrice Arruda96850362020-08-11 20:41:11 +0000267}
David Goldsmith62243a32022-04-08 13:42:04 +0000268
269message ExpConfigFetcher {
270 enum ConfigStatus {
271 NO_CONFIG = 0;
272 CONFIG = 1;
273 ERROR = 2;
Kousik Kumarc75e1292022-07-07 02:20:51 +0000274 MISSING_GCERT = 3;
David Goldsmith62243a32022-04-08 13:42:04 +0000275 }
276 // The result of the call to expconfigfetcher
277 // NO_CONFIG - Not part of experiment
278 // CONFIG - Part of experiment, config copied successfully
279 // ERROR - expconfigfetcher failed
280 optional ConfigStatus status = 1;
281
282 // The output config filename
283 optional string filename = 2;
284
285 // Time, in microseconds, taken by the expconfigfetcher
286 optional uint64 micros = 3;
287}
MarkDacekff851b82022-04-21 18:33:17 +0000288
289message MixedBuildsInfo{
290 // Modules may be listed below as both enabled for Mixed Builds
291 // and disabled for Mixed Builds. This implies that some variants
292 // of the module are handled by Bazel in a Mixed Build, and other
293 // variants of the same module are handled by Soong.
294
295 // Modules that are enabled for Mixed Builds.
296 repeated string mixed_build_enabled_modules = 1;
297
298 // Modules that are not currently eligible to be handled
299 // by Bazel in a Mixed Build.
300 // Note that not all modules exempt from Bazel handling are
301 // listed. This list includes only modules which are of a
302 // Mixed-Build supported module type but are nevertheless not
303 // handled by Bazel. This may occur due to being present in
304 // the mixed build denylist, or as part of an unsupported
305 // mixed build variant type such as Windows.
306
307 // Modules that are not enabled for MixedBuilds
308 repeated string mixed_build_disabled_modules = 2;
309}