metrics.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. syntax = "proto2";
  15. package soong_build_metrics;
  16. option go_package = "android/soong/ui/metrics/metrics_proto";
  17. message MetricsBase {
  18. // Timestamp generated when the build starts.
  19. optional int64 build_date_timestamp = 1;
  20. // It is usually used to specify the branch name [and release candidate].
  21. optional string build_id = 2;
  22. // The platform version codename, eg. P, Q, REL.
  23. optional string platform_version_codename = 3;
  24. // The target product information, eg. aosp_arm.
  25. optional string target_product = 4;
  26. enum BuildVariant {
  27. USER = 0;
  28. USERDEBUG = 1;
  29. ENG = 2;
  30. }
  31. // The target build variant information, eg. eng.
  32. optional BuildVariant target_build_variant = 5 [default = ENG];
  33. enum Arch {
  34. UNKNOWN = 0;
  35. ARM = 1;
  36. ARM64 = 2;
  37. X86 = 3;
  38. X86_64 = 4;
  39. }
  40. // The target arch information, eg. arm.
  41. optional Arch target_arch = 6 [default = UNKNOWN];
  42. // The target arch variant information, eg. armv7-a-neon.
  43. optional string target_arch_variant = 7;
  44. // The target cpu variant information, eg. generic.
  45. optional string target_cpu_variant = 8;
  46. // The host arch information, eg. x86_64.
  47. optional Arch host_arch = 9 [default = UNKNOWN];
  48. // The host 2nd arch information, eg. x86.
  49. optional Arch host_2nd_arch = 10 [default = UNKNOWN];
  50. // The host os information, eg. linux.
  51. optional string host_os = 11;
  52. // The host os extra information, eg. Linux-4.17.0-3rodete2-amd64-x86_64-Debian-GNU.
  53. optional string host_os_extra = 12;
  54. // The host cross os information, eg. windows.
  55. optional string host_cross_os = 13;
  56. // The host cross arch information, eg. x86.
  57. optional string host_cross_arch = 14;
  58. // The host cross 2nd arch information, eg. x86_64.
  59. optional string host_cross_2nd_arch = 15;
  60. // The directory for generated built artifacts installation, eg. out.
  61. optional string out_dir = 16;
  62. // The metrics for calling various tools (microfactory) before Soong_UI starts.
  63. repeated PerfInfo setup_tools = 17;
  64. // The metrics for calling Kati by multiple times.
  65. repeated PerfInfo kati_runs = 18;
  66. // The metrics for calling Soong.
  67. repeated PerfInfo soong_runs = 19;
  68. // The metrics for calling Ninja.
  69. repeated PerfInfo ninja_runs = 20;
  70. // The metrics for the whole build
  71. optional PerfInfo total = 21;
  72. // Deprecated because instead of embedding in a MetricsBase, we keep
  73. // SoongBuildMetrics in its own file
  74. optional SoongBuildMetrics soong_build_metrics = 22 [deprecated=true];
  75. optional BuildConfig build_config = 23;
  76. // The hostname of the machine.
  77. optional string hostname = 24;
  78. // The system resource information such as total physical memory.
  79. optional SystemResourceInfo system_resource_info = 25;
  80. // The build command that the user entered to the build system.
  81. optional string build_command = 26;
  82. // The metrics for calling Bazel.
  83. repeated PerfInfo bazel_runs = 27;
  84. // The metrics of the experiment config fetcher
  85. optional ExpConfigFetcher exp_config_fetcher = 28;
  86. // Whether the build exited with a panic or non-zero exit code, includes both
  87. // non-zero exits of recorded phases and non-recorded phases of the build.
  88. optional bool non_zero_exit = 29;
  89. // The error message due to a non-zero exit _only_ if it did not occur in a
  90. // recorded phase of the build.
  91. optional string error_message = 30;
  92. // The Git Manifest for the user's branch.
  93. optional string manifest_url = 31;
  94. // The branch on which the build occurred.
  95. // Example: refs/heads/master
  96. optional string branch = 32;
  97. // The metric of critical path in build
  98. optional CriticalPathInfo critical_path_info = 33;
  99. // Environment variables that have changed value since the previous build,
  100. // which were responsible for retriggering build analysis.
  101. // Note that not all changed environment variables result in analysis retriggering.
  102. // If there was no previous build, this list will be empty.
  103. repeated string changed_environment_variable = 34;
  104. }
  105. message BuildConfig {
  106. enum NinjaWeightListSource {
  107. NOT_USED = 0;
  108. NINJA_LOG = 1;
  109. EVENLY_DISTRIBUTED = 2;
  110. EXTERNAL_FILE = 3;
  111. HINT_FROM_SOONG = 4;
  112. }
  113. optional bool use_goma = 1;
  114. optional bool use_rbe = 2;
  115. optional bool force_use_goma = 3;
  116. // Whether the Bazel is acting as the Ninja executor for this build.
  117. optional bool bazel_as_ninja = 4;
  118. // Whether build is occurring in a mixed build mode, where Bazel maintains the
  119. // definition and build of some modules in cooperation with Soong.
  120. optional bool bazel_mixed_build = 5;
  121. // These are the targets soong passes to ninja, these targets include special
  122. // targets such as droid as well as the regular build targets.
  123. repeated string targets = 6;
  124. // Whether the user explicitly disabled bazel mixed builds for this build.
  125. optional bool force_disable_bazel_mixed_build = 7;
  126. // NOT_USED - ninja doesn't use weight list.
  127. // NINJA_LOG - ninja uses weight list based on previous builds by ninja log
  128. // EVENLY_DISTRIBUTED - ninja thinks every task has the same weight.
  129. // EXTERNAL_FILE - ninja uses an external custom weight list
  130. // HINT_FROM_SOONG - ninja uses a prioritized module list from Soong
  131. optional NinjaWeightListSource ninja_weight_list_source = 8 [default = NOT_USED];
  132. }
  133. message SystemResourceInfo {
  134. // The total physical memory in bytes.
  135. optional uint64 total_physical_memory = 1;
  136. // The total of available cores for building
  137. optional int32 available_cpus = 2;
  138. }
  139. message PerfInfo {
  140. // The description for the phase/action/part while the tool running.
  141. optional string description = 1;
  142. // The name for the running phase/action/part.
  143. optional string name = 2;
  144. // The absolute start time.
  145. // The number of nanoseconds elapsed since January 1, 1970 UTC.
  146. optional uint64 start_time = 3;
  147. // The real running time.
  148. // The number of nanoseconds elapsed since start_time.
  149. optional uint64 real_time = 4;
  150. // The number of MB for memory use (deprecated as it is too generic).
  151. optional uint64 memory_use = 5 [deprecated=true];
  152. // The resource information of each executed process.
  153. repeated ProcessResourceInfo processes_resource_info = 6;
  154. // Whether the phase of tool running exited with a panic or non-zero exit
  155. // code.
  156. optional bool non_zero_exit = 7;
  157. // The error message, if any, due to a non-zero exit.
  158. optional string error_message = 8;
  159. }
  160. message ProcessResourceInfo {
  161. // The name of the process for identification.
  162. optional string name = 1;
  163. // The amount of time spent executing in user space in microseconds.
  164. optional uint64 user_time_micros = 2;
  165. // The amount of time spent executing in kernel mode in microseconds.
  166. optional uint64 system_time_micros = 3;
  167. // The maximum resident set size memory used in kilobytes.
  168. optional uint64 max_rss_kb = 4;
  169. // The number of minor page faults serviced without any I/O activity.
  170. optional uint64 minor_page_faults = 5;
  171. // The number of major page faults serviced that required I/O activity.
  172. optional uint64 major_page_faults = 6;
  173. // Total IO input in kilobytes.
  174. optional uint64 io_input_kb= 7;
  175. // Total IO output in kilobytes.
  176. optional uint64 io_output_kb = 8;
  177. // The number of voluntary context switches
  178. optional uint64 voluntary_context_switches = 9;
  179. // The number of involuntary context switches
  180. optional uint64 involuntary_context_switches = 10;
  181. }
  182. message ModuleTypeInfo {
  183. enum BuildSystem {
  184. UNKNOWN = 0;
  185. SOONG = 1;
  186. MAKE = 2;
  187. }
  188. // The build system, e.g. Soong or Make.
  189. optional BuildSystem build_system = 1 [default = UNKNOWN];
  190. // The module type, e.g. java_library, cc_binary, and etc.
  191. optional string module_type = 2;
  192. // The number of logical modules.
  193. optional uint32 num_of_modules = 3;
  194. }
  195. message CriticalUserJourneyMetrics {
  196. // The name of a critical user journey test.
  197. optional string name = 1;
  198. // The metrics produced when running the critical user journey test.
  199. optional MetricsBase metrics = 2;
  200. }
  201. message CriticalUserJourneysMetrics {
  202. // A set of metrics from a run of the critical user journey tests.
  203. repeated CriticalUserJourneyMetrics cujs = 1;
  204. }
  205. message SoongBuildMetrics {
  206. // The number of modules handled by soong_build.
  207. optional uint32 modules = 1;
  208. // The total number of variants handled by soong_build.
  209. optional uint32 variants = 2;
  210. // The total number of allocations in soong_build.
  211. optional uint64 total_alloc_count = 3;
  212. // The total size of allocations in soong_build in bytes.
  213. optional uint64 total_alloc_size = 4;
  214. // The approximate maximum size of the heap in soong_build in bytes.
  215. optional uint64 max_heap_size = 5;
  216. // Runtime metrics for soong_build execution.
  217. repeated PerfInfo events = 6;
  218. // Mixed Builds information
  219. optional MixedBuildsInfo mixed_builds_info = 7;
  220. }
  221. message ExpConfigFetcher {
  222. enum ConfigStatus {
  223. NO_CONFIG = 0;
  224. CONFIG = 1;
  225. ERROR = 2;
  226. MISSING_GCERT = 3;
  227. }
  228. // The result of the call to expconfigfetcher
  229. // NO_CONFIG - Not part of experiment
  230. // CONFIG - Part of experiment, config copied successfully
  231. // ERROR - expconfigfetcher failed
  232. optional ConfigStatus status = 1;
  233. // The output config filename
  234. optional string filename = 2;
  235. // Time, in microseconds, taken by the expconfigfetcher
  236. optional uint64 micros = 3;
  237. }
  238. message MixedBuildsInfo{
  239. // Modules may be listed below as both enabled for Mixed Builds
  240. // and disabled for Mixed Builds. This implies that some variants
  241. // of the module are handled by Bazel in a Mixed Build, and other
  242. // variants of the same module are handled by Soong.
  243. // Modules that are enabled for Mixed Builds.
  244. repeated string mixed_build_enabled_modules = 1;
  245. // Modules that are not currently eligible to be handled
  246. // by Bazel in a Mixed Build.
  247. // Note that not all modules exempt from Bazel handling are
  248. // listed. This list includes only modules which are of a
  249. // Mixed-Build supported module type but are nevertheless not
  250. // handled by Bazel. This may occur due to being present in
  251. // the mixed build denylist, or as part of an unsupported
  252. // mixed build variant type such as Windows.
  253. // Modules that are not enabled for MixedBuilds
  254. repeated string mixed_build_disabled_modules = 2;
  255. }
  256. // CriticalPathInfo contains critical path nodes's information.
  257. // A critical path is a path determining the minimum time needed for the whole build given perfect parallelism.
  258. message CriticalPathInfo {
  259. // Real time which the build system spent in microseconds
  260. optional uint64 elapsed_time_micros = 1;
  261. // The sum of execution time of the longest path from leave to the root in microseconds
  262. optional uint64 critical_path_time_micros = 2;
  263. // Detailed job information in a critical path.
  264. repeated JobInfo critical_path = 4;
  265. // Detailed job information for long running jobs (>30 seconds). These may or may not also be on a critical path.
  266. repeated JobInfo long_running_jobs = 5;
  267. }
  268. message JobInfo {
  269. // Real time which a job spent in microseconds
  270. optional uint64 elapsed_time_micros = 1;
  271. // Description of a job
  272. optional string job_description = 2;
  273. }