metrics.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. }
  100. message BuildConfig {
  101. optional bool use_goma = 1;
  102. optional bool use_rbe = 2;
  103. optional bool force_use_goma = 3;
  104. // Whether the Bazel is acting as the Ninja executor for this build.
  105. optional bool bazel_as_ninja = 4;
  106. // Whether build is occurring in a mixed build mode, where Bazel maintains the
  107. // definition and build of some modules in cooperation with Soong.
  108. optional bool bazel_mixed_build = 5;
  109. // These are the targets soong passes to ninja, these targets include special
  110. // targets such as droid as well as the regular build targets.
  111. repeated string targets = 6;
  112. // Whether the user explicitly disabled bazel mixed builds for this build.
  113. optional bool force_disable_bazel_mixed_build = 7;
  114. }
  115. message SystemResourceInfo {
  116. // The total physical memory in bytes.
  117. optional uint64 total_physical_memory = 1;
  118. // The total of available cores for building
  119. optional int32 available_cpus = 2;
  120. }
  121. message PerfInfo {
  122. // The description for the phase/action/part while the tool running.
  123. optional string description = 1;
  124. // The name for the running phase/action/part.
  125. optional string name = 2;
  126. // The absolute start time.
  127. // The number of nanoseconds elapsed since January 1, 1970 UTC.
  128. optional uint64 start_time = 3;
  129. // The real running time.
  130. // The number of nanoseconds elapsed since start_time.
  131. optional uint64 real_time = 4;
  132. // The number of MB for memory use (deprecated as it is too generic).
  133. optional uint64 memory_use = 5 [deprecated=true];
  134. // The resource information of each executed process.
  135. repeated ProcessResourceInfo processes_resource_info = 6;
  136. // Whether the phase of tool running exited with a panic or non-zero exit
  137. // code.
  138. optional bool non_zero_exit = 7;
  139. // The error message, if any, due to a non-zero exit.
  140. optional string error_message = 8;
  141. }
  142. message ProcessResourceInfo {
  143. // The name of the process for identification.
  144. optional string name = 1;
  145. // The amount of time spent executing in user space in microseconds.
  146. optional uint64 user_time_micros = 2;
  147. // The amount of time spent executing in kernel mode in microseconds.
  148. optional uint64 system_time_micros = 3;
  149. // The maximum resident set size memory used in kilobytes.
  150. optional uint64 max_rss_kb = 4;
  151. // The number of minor page faults serviced without any I/O activity.
  152. optional uint64 minor_page_faults = 5;
  153. // The number of major page faults serviced that required I/O activity.
  154. optional uint64 major_page_faults = 6;
  155. // Total IO input in kilobytes.
  156. optional uint64 io_input_kb= 7;
  157. // Total IO output in kilobytes.
  158. optional uint64 io_output_kb = 8;
  159. // The number of voluntary context switches
  160. optional uint64 voluntary_context_switches = 9;
  161. // The number of involuntary context switches
  162. optional uint64 involuntary_context_switches = 10;
  163. }
  164. message ModuleTypeInfo {
  165. enum BuildSystem {
  166. UNKNOWN = 0;
  167. SOONG = 1;
  168. MAKE = 2;
  169. }
  170. // The build system, e.g. Soong or Make.
  171. optional BuildSystem build_system = 1 [default = UNKNOWN];
  172. // The module type, e.g. java_library, cc_binary, and etc.
  173. optional string module_type = 2;
  174. // The number of logical modules.
  175. optional uint32 num_of_modules = 3;
  176. }
  177. message CriticalUserJourneyMetrics {
  178. // The name of a critical user journey test.
  179. optional string name = 1;
  180. // The metrics produced when running the critical user journey test.
  181. optional MetricsBase metrics = 2;
  182. }
  183. message CriticalUserJourneysMetrics {
  184. // A set of metrics from a run of the critical user journey tests.
  185. repeated CriticalUserJourneyMetrics cujs = 1;
  186. }
  187. message SoongBuildMetrics {
  188. // The number of modules handled by soong_build.
  189. optional uint32 modules = 1;
  190. // The total number of variants handled by soong_build.
  191. optional uint32 variants = 2;
  192. // The total number of allocations in soong_build.
  193. optional uint64 total_alloc_count = 3;
  194. // The total size of allocations in soong_build in bytes.
  195. optional uint64 total_alloc_size = 4;
  196. // The approximate maximum size of the heap in soong_build in bytes.
  197. optional uint64 max_heap_size = 5;
  198. // Runtime metrics for soong_build execution.
  199. repeated PerfInfo events = 6;
  200. // Mixed Builds information
  201. optional MixedBuildsInfo mixed_builds_info = 7;
  202. }
  203. message ExpConfigFetcher {
  204. enum ConfigStatus {
  205. NO_CONFIG = 0;
  206. CONFIG = 1;
  207. ERROR = 2;
  208. MISSING_GCERT = 3;
  209. }
  210. // The result of the call to expconfigfetcher
  211. // NO_CONFIG - Not part of experiment
  212. // CONFIG - Part of experiment, config copied successfully
  213. // ERROR - expconfigfetcher failed
  214. optional ConfigStatus status = 1;
  215. // The output config filename
  216. optional string filename = 2;
  217. // Time, in microseconds, taken by the expconfigfetcher
  218. optional uint64 micros = 3;
  219. }
  220. message MixedBuildsInfo{
  221. // Modules may be listed below as both enabled for Mixed Builds
  222. // and disabled for Mixed Builds. This implies that some variants
  223. // of the module are handled by Bazel in a Mixed Build, and other
  224. // variants of the same module are handled by Soong.
  225. // Modules that are enabled for Mixed Builds.
  226. repeated string mixed_build_enabled_modules = 1;
  227. // Modules that are not currently eligible to be handled
  228. // by Bazel in a Mixed Build.
  229. // Note that not all modules exempt from Bazel handling are
  230. // listed. This list includes only modules which are of a
  231. // Mixed-Build supported module type but are nevertheless not
  232. // handled by Bazel. This may occur due to being present in
  233. // the mixed build denylist, or as part of an unsupported
  234. // mixed build variant type such as Windows.
  235. // Modules that are not enabled for MixedBuilds
  236. repeated string mixed_build_disabled_modules = 2;
  237. }
  238. message CriticalPathInfo{
  239. // Real time which the build system spent
  240. optional uint64 elapsed_time = 1;
  241. // The sum of execution time of the longest path from leave to the root
  242. optional uint64 critical_path_time = 2;
  243. // Detailed job information in a critical path.
  244. repeated JobInfo critical_path = 4;
  245. }
  246. message JobInfo{
  247. // Real time which a job spent
  248. optional uint64 elapsed_time = 1;
  249. // Description of a job
  250. optional string job_description = 2;
  251. }