Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 1 | // 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 | |
| 15 | syntax = "proto2"; |
| 16 | |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 17 | package soong_build_metrics; |
Dan Willemsen | 4591b64 | 2021-05-24 14:24:12 -0700 | [diff] [blame] | 18 | option go_package = "android/soong/ui/metrics/metrics_proto"; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 19 | |
| 20 | message 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 Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 33 | enum BuildVariant { |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 34 | USER = 0; |
| 35 | USERDEBUG = 1; |
| 36 | ENG = 2; |
| 37 | } |
| 38 | // The target build variant information, eg. eng. |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 39 | optional BuildVariant target_build_variant = 5 [default = ENG]; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 40 | |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 41 | enum Arch { |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 42 | UNKNOWN = 0; |
| 43 | ARM = 1; |
| 44 | ARM64 = 2; |
| 45 | X86 = 3; |
| 46 | X86_64 = 4; |
| 47 | } |
| 48 | // The target arch information, eg. arm. |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 49 | optional Arch target_arch = 6 [default = UNKNOWN]; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 50 | |
| 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 Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 58 | optional Arch host_arch = 9 [default = UNKNOWN]; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 59 | |
| 60 | // The host 2nd arch information, eg. x86. |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 61 | optional Arch host_2nd_arch = 10 [default = UNKNOWN]; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 62 | |
| 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 Cross | 74cda72 | 2020-01-16 15:25:50 -0800 | [diff] [blame] | 92 | |
| 93 | // The metrics for the whole build |
| 94 | optional PerfInfo total = 21; |
Colin Cross | b72c909 | 2020-02-10 11:23:49 -0800 | [diff] [blame] | 95 | |
Jason Wu | 41886f2 | 2023-01-04 11:29:36 -0500 | [diff] [blame] | 96 | // 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 Arruda | 9685036 | 2020-08-11 20:41:11 +0000 | [diff] [blame] | 99 | |
| 100 | optional BuildConfig build_config = 23; |
Patrice Arruda | 4fb8adc | 2020-10-12 22:38:06 +0000 | [diff] [blame] | 101 | |
| 102 | // The hostname of the machine. |
| 103 | optional string hostname = 24; |
Patrice Arruda | 3edfd48 | 2020-10-13 23:58:41 +0000 | [diff] [blame] | 104 | |
| 105 | // The system resource information such as total physical memory. |
| 106 | optional SystemResourceInfo system_resource_info = 25; |
Patrice Arruda | e92c30d | 2020-10-29 11:01:32 -0700 | [diff] [blame] | 107 | |
| 108 | // The build command that the user entered to the build system. |
| 109 | optional string build_command = 26; |
Patrice Arruda | b7cf9ba | 2020-11-13 13:04:17 -0800 | [diff] [blame] | 110 | |
| 111 | // The metrics for calling Bazel. |
| 112 | repeated PerfInfo bazel_runs = 27; |
David Goldsmith | 62243a3 | 2022-04-08 13:42:04 +0000 | [diff] [blame] | 113 | |
| 114 | // The metrics of the experiment config fetcher |
| 115 | optional ExpConfigFetcher exp_config_fetcher = 28; |
Liz Kammer | f2a80c6 | 2022-10-21 10:42:35 -0400 | [diff] [blame] | 116 | |
| 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; |
MarkDacek | a18ba22 | 2023-03-07 18:18:19 +0000 | [diff] [blame] | 124 | |
| 125 | // The Git Manifest for the user's branch. |
| 126 | optional string manifest_url = 31; |
| 127 | |
| 128 | // The branch on which the build occurred. |
| 129 | // Example: refs/heads/master |
| 130 | optional string branch = 32; |
Jeongik Cha | 28c1fe5 | 2023-03-07 15:19:44 +0900 | [diff] [blame] | 131 | |
| 132 | // The metric of critical path in build |
| 133 | optional CriticalPathInfo critical_path_info = 33; |
Jason Wu | 2520f5e | 2023-05-30 19:45:36 -0400 | [diff] [blame] | 134 | |
| 135 | // Environment variables that have changed value since the previous build, |
| 136 | // which were responsible for retriggering build analysis. |
| 137 | // Note that not all changed environment variables result in analysis retriggering. |
| 138 | // If there was no previous build, this list will be empty. |
| 139 | repeated string changed_environment_variable = 34; |
Patrice Arruda | 9685036 | 2020-08-11 20:41:11 +0000 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | message BuildConfig { |
Jeongik Cha | 8d63d56 | 2023-03-17 03:52:13 +0900 | [diff] [blame] | 143 | enum NinjaWeightListSource { |
| 144 | NOT_USED = 0; |
| 145 | NINJA_LOG = 1; |
| 146 | EVENLY_DISTRIBUTED = 2; |
Jeongik Cha | 518f3ea | 2023-03-19 00:12:39 +0900 | [diff] [blame] | 147 | EXTERNAL_FILE = 3; |
Jeongik Cha | e114e60 | 2023-03-19 00:12:39 +0900 | [diff] [blame] | 148 | HINT_FROM_SOONG = 4; |
Jeongik Cha | 8d63d56 | 2023-03-17 03:52:13 +0900 | [diff] [blame] | 149 | } |
| 150 | |
Patrice Arruda | 9685036 | 2020-08-11 20:41:11 +0000 | [diff] [blame] | 151 | optional bool use_goma = 1; |
| 152 | |
| 153 | optional bool use_rbe = 2; |
Patrice Arruda | c97d6dc | 2020-09-28 18:22:07 +0000 | [diff] [blame] | 154 | |
| 155 | optional bool force_use_goma = 3; |
Liz Kammer | ca9cb2e | 2021-07-14 15:29:57 -0400 | [diff] [blame] | 156 | |
| 157 | // Whether the Bazel is acting as the Ninja executor for this build. |
| 158 | optional bool bazel_as_ninja = 4; |
| 159 | |
| 160 | // Whether build is occurring in a mixed build mode, where Bazel maintains the |
| 161 | // definition and build of some modules in cooperation with Soong. |
| 162 | optional bool bazel_mixed_build = 5; |
Yu Liu | e737a99 | 2021-10-04 13:21:41 -0700 | [diff] [blame] | 163 | |
| 164 | // These are the targets soong passes to ninja, these targets include special |
| 165 | // targets such as droid as well as the regular build targets. |
| 166 | repeated string targets = 6; |
Romain Jobredeaux | ea098ef | 2022-10-20 14:24:31 -0400 | [diff] [blame] | 167 | |
| 168 | // Whether the user explicitly disabled bazel mixed builds for this build. |
| 169 | optional bool force_disable_bazel_mixed_build = 7; |
Jeongik Cha | 0cf44d5 | 2023-03-15 00:10:45 +0900 | [diff] [blame] | 170 | |
| 171 | // NOT_USED - ninja doesn't use weight list. |
| 172 | // NINJA_LOG - ninja uses weight list based on previous builds by ninja log |
| 173 | // EVENLY_DISTRIBUTED - ninja thinks every task has the same weight. |
Jeongik Cha | 518f3ea | 2023-03-19 00:12:39 +0900 | [diff] [blame] | 174 | // EXTERNAL_FILE - ninja uses an external custom weight list |
Jeongik Cha | e114e60 | 2023-03-19 00:12:39 +0900 | [diff] [blame] | 175 | // HINT_FROM_SOONG - ninja uses a prioritized module list from Soong |
Jeongik Cha | 0cf44d5 | 2023-03-15 00:10:45 +0900 | [diff] [blame] | 176 | optional NinjaWeightListSource ninja_weight_list_source = 8 [default = NOT_USED]; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 177 | } |
| 178 | |
Patrice Arruda | 3edfd48 | 2020-10-13 23:58:41 +0000 | [diff] [blame] | 179 | message SystemResourceInfo { |
| 180 | // The total physical memory in bytes. |
| 181 | optional uint64 total_physical_memory = 1; |
| 182 | |
| 183 | // The total of available cores for building |
| 184 | optional int32 available_cpus = 2; |
| 185 | } |
| 186 | |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 187 | message PerfInfo { |
| 188 | // The description for the phase/action/part while the tool running. |
Yu Liu | 37c3dd3 | 2021-09-30 14:46:18 -0700 | [diff] [blame] | 189 | optional string description = 1; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 190 | |
| 191 | // The name for the running phase/action/part. |
| 192 | optional string name = 2; |
| 193 | |
| 194 | // The absolute start time. |
| 195 | // The number of nanoseconds elapsed since January 1, 1970 UTC. |
| 196 | optional uint64 start_time = 3; |
| 197 | |
| 198 | // The real running time. |
| 199 | // The number of nanoseconds elapsed since start_time. |
| 200 | optional uint64 real_time = 4; |
| 201 | |
Patrice Arruda | fec3bf2 | 2020-10-19 10:55:34 -0700 | [diff] [blame] | 202 | // The number of MB for memory use (deprecated as it is too generic). |
| 203 | optional uint64 memory_use = 5 [deprecated=true]; |
| 204 | |
| 205 | // The resource information of each executed process. |
| 206 | repeated ProcessResourceInfo processes_resource_info = 6; |
Liz Kammer | f2a80c6 | 2022-10-21 10:42:35 -0400 | [diff] [blame] | 207 | |
| 208 | // Whether the phase of tool running exited with a panic or non-zero exit |
| 209 | // code. |
| 210 | optional bool non_zero_exit = 7; |
| 211 | |
| 212 | // The error message, if any, due to a non-zero exit. |
| 213 | optional string error_message = 8; |
Patrice Arruda | fec3bf2 | 2020-10-19 10:55:34 -0700 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | message ProcessResourceInfo { |
| 217 | // The name of the process for identification. |
| 218 | optional string name = 1; |
| 219 | |
| 220 | // The amount of time spent executing in user space in microseconds. |
| 221 | optional uint64 user_time_micros = 2; |
| 222 | |
| 223 | // The amount of time spent executing in kernel mode in microseconds. |
| 224 | optional uint64 system_time_micros = 3; |
| 225 | |
| 226 | // The maximum resident set size memory used in kilobytes. |
| 227 | optional uint64 max_rss_kb = 4; |
| 228 | |
| 229 | // The number of minor page faults serviced without any I/O activity. |
| 230 | optional uint64 minor_page_faults = 5; |
| 231 | |
| 232 | // The number of major page faults serviced that required I/O activity. |
| 233 | optional uint64 major_page_faults = 6; |
| 234 | |
| 235 | // Total IO input in kilobytes. |
| 236 | optional uint64 io_input_kb= 7; |
| 237 | |
| 238 | // Total IO output in kilobytes. |
| 239 | optional uint64 io_output_kb = 8; |
| 240 | |
| 241 | // The number of voluntary context switches |
| 242 | optional uint64 voluntary_context_switches = 9; |
| 243 | |
| 244 | // The number of involuntary context switches |
| 245 | optional uint64 involuntary_context_switches = 10; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | message ModuleTypeInfo { |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 249 | enum BuildSystem { |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 250 | UNKNOWN = 0; |
| 251 | SOONG = 1; |
| 252 | MAKE = 2; |
| 253 | } |
MarkDacek | ff851b8 | 2022-04-21 18:33:17 +0000 | [diff] [blame] | 254 | // The build system, e.g. Soong or Make. |
Patrice Arruda | 0cc5b21 | 2019-06-14 15:27:46 -0700 | [diff] [blame] | 255 | optional BuildSystem build_system = 1 [default = UNKNOWN]; |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 256 | |
MarkDacek | ff851b8 | 2022-04-21 18:33:17 +0000 | [diff] [blame] | 257 | // The module type, e.g. java_library, cc_binary, and etc. |
Nan Zhang | 17f2767 | 2018-12-12 16:01:49 -0800 | [diff] [blame] | 258 | optional string module_type = 2; |
| 259 | |
| 260 | // The number of logical modules. |
| 261 | optional uint32 num_of_modules = 3; |
| 262 | } |
Colin Cross | d0be210 | 2019-11-26 16:16:57 -0800 | [diff] [blame] | 263 | |
| 264 | message CriticalUserJourneyMetrics { |
| 265 | // The name of a critical user journey test. |
| 266 | optional string name = 1; |
| 267 | |
| 268 | // The metrics produced when running the critical user journey test. |
| 269 | optional MetricsBase metrics = 2; |
| 270 | } |
| 271 | |
| 272 | message CriticalUserJourneysMetrics { |
| 273 | // A set of metrics from a run of the critical user journey tests. |
| 274 | repeated CriticalUserJourneyMetrics cujs = 1; |
Colin Cross | b72c909 | 2020-02-10 11:23:49 -0800 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | message SoongBuildMetrics { |
| 278 | // The number of modules handled by soong_build. |
| 279 | optional uint32 modules = 1; |
| 280 | |
| 281 | // The total number of variants handled by soong_build. |
| 282 | optional uint32 variants = 2; |
| 283 | |
| 284 | // The total number of allocations in soong_build. |
| 285 | optional uint64 total_alloc_count = 3; |
| 286 | |
| 287 | // The total size of allocations in soong_build in bytes. |
| 288 | optional uint64 total_alloc_size = 4; |
| 289 | |
| 290 | // The approximate maximum size of the heap in soong_build in bytes. |
| 291 | optional uint64 max_heap_size = 5; |
Chris Parsons | 715b08f | 2022-03-22 19:23:40 -0400 | [diff] [blame] | 292 | |
| 293 | // Runtime metrics for soong_build execution. |
| 294 | repeated PerfInfo events = 6; |
MarkDacek | ff851b8 | 2022-04-21 18:33:17 +0000 | [diff] [blame] | 295 | |
| 296 | // Mixed Builds information |
| 297 | optional MixedBuildsInfo mixed_builds_info = 7; |
Patrice Arruda | 9685036 | 2020-08-11 20:41:11 +0000 | [diff] [blame] | 298 | } |
David Goldsmith | 62243a3 | 2022-04-08 13:42:04 +0000 | [diff] [blame] | 299 | |
| 300 | message ExpConfigFetcher { |
| 301 | enum ConfigStatus { |
| 302 | NO_CONFIG = 0; |
| 303 | CONFIG = 1; |
| 304 | ERROR = 2; |
Kousik Kumar | c75e129 | 2022-07-07 02:20:51 +0000 | [diff] [blame] | 305 | MISSING_GCERT = 3; |
David Goldsmith | 62243a3 | 2022-04-08 13:42:04 +0000 | [diff] [blame] | 306 | } |
| 307 | // The result of the call to expconfigfetcher |
| 308 | // NO_CONFIG - Not part of experiment |
| 309 | // CONFIG - Part of experiment, config copied successfully |
| 310 | // ERROR - expconfigfetcher failed |
| 311 | optional ConfigStatus status = 1; |
| 312 | |
| 313 | // The output config filename |
| 314 | optional string filename = 2; |
| 315 | |
| 316 | // Time, in microseconds, taken by the expconfigfetcher |
| 317 | optional uint64 micros = 3; |
| 318 | } |
MarkDacek | ff851b8 | 2022-04-21 18:33:17 +0000 | [diff] [blame] | 319 | |
| 320 | message MixedBuildsInfo{ |
| 321 | // Modules may be listed below as both enabled for Mixed Builds |
| 322 | // and disabled for Mixed Builds. This implies that some variants |
| 323 | // of the module are handled by Bazel in a Mixed Build, and other |
| 324 | // variants of the same module are handled by Soong. |
| 325 | |
| 326 | // Modules that are enabled for Mixed Builds. |
| 327 | repeated string mixed_build_enabled_modules = 1; |
| 328 | |
| 329 | // Modules that are not currently eligible to be handled |
| 330 | // by Bazel in a Mixed Build. |
| 331 | // Note that not all modules exempt from Bazel handling are |
| 332 | // listed. This list includes only modules which are of a |
| 333 | // Mixed-Build supported module type but are nevertheless not |
| 334 | // handled by Bazel. This may occur due to being present in |
| 335 | // the mixed build denylist, or as part of an unsupported |
| 336 | // mixed build variant type such as Windows. |
| 337 | |
| 338 | // Modules that are not enabled for MixedBuilds |
| 339 | repeated string mixed_build_disabled_modules = 2; |
| 340 | } |
Jeongik Cha | 28c1fe5 | 2023-03-07 15:19:44 +0900 | [diff] [blame] | 341 | |
Jeongik Cha | cf83377 | 2023-03-15 12:54:14 +0900 | [diff] [blame] | 342 | // CriticalPathInfo contains critical path nodes's information. |
| 343 | // A critical path is a path determining the minimum time needed for the whole build given perfect parallelism. |
Jeongik Cha | 4199d47 | 2023-03-15 10:47:35 +0900 | [diff] [blame] | 344 | message CriticalPathInfo { |
Jeongik Cha | 767ce71 | 2023-03-15 23:20:00 +0900 | [diff] [blame] | 345 | // Real time which the build system spent in microseconds |
| 346 | optional uint64 elapsed_time_micros = 1; |
| 347 | // The sum of execution time of the longest path from leave to the root in microseconds |
| 348 | optional uint64 critical_path_time_micros = 2; |
Jeongik Cha | 28c1fe5 | 2023-03-07 15:19:44 +0900 | [diff] [blame] | 349 | // Detailed job information in a critical path. |
| 350 | repeated JobInfo critical_path = 4; |
Jeongik Cha | 4199d47 | 2023-03-15 10:47:35 +0900 | [diff] [blame] | 351 | // Detailed job information for long running jobs (>30 seconds). These may or may not also be on a critical path. |
| 352 | repeated JobInfo long_running_jobs = 5; |
Jeongik Cha | 28c1fe5 | 2023-03-07 15:19:44 +0900 | [diff] [blame] | 353 | } |
| 354 | |
Jeongik Cha | 4199d47 | 2023-03-15 10:47:35 +0900 | [diff] [blame] | 355 | message JobInfo { |
Jeongik Cha | 767ce71 | 2023-03-15 23:20:00 +0900 | [diff] [blame] | 356 | // Real time which a job spent in microseconds |
| 357 | optional uint64 elapsed_time_micros = 1; |
Jeongik Cha | 28c1fe5 | 2023-03-07 15:19:44 +0900 | [diff] [blame] | 358 | // Description of a job |
| 359 | optional string job_description = 2; |
| 360 | } |