简体   繁体   中英

How to get build times of individual targets with bazel?

We have a bunch of targets being built by Bazel in our build environment today, targets being cc_binary / cc_test / cc_library etc. Is there some Bazel option that dumps build time for each of these into a file so we can analyze it after the build is done. While building Bazel dumps some timing information that disappears fast but I am looking for something (either text/XML or any other readable format) that can be used in post-build analysis.

To some extent this is possible. Look at the documentation: Performance profiling

There is the build flag --experimental_generate_json_trace_profile that generates a file named command.profile.gz in our outputBase dir (details about the outputBase dir can be fond here ).

Example:

bazel build --experimental_generate_json_trace_profile --experimental_profile_cpu_usage //:HelloWorld

command.profile.gz contains a file named command.profile . This can be view in Chrome ( chrome://tracing/ ).

在此处输入图片说明

(Tested with Bazel 2.0.0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM