diff options
author | Yi Kong <yikong@google.com> | 2022-05-18 10:38:44 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-05-18 10:38:44 +0000 |
commit | ad84a5a58de3deefa02659ab364f42e615ba1f46 (patch) | |
tree | 4e91d7f043bfb61dfb301319ca606e8cd0f13462 | |
parent | 9645fcd9a0589b5d21ef58fabd9135724ad1f2e0 (diff) | |
parent | f88052ae38c966b0f30c4f034389ea721d0895c9 (diff) | |
download | linux-x86-ad84a5a58de3deefa02659ab364f42e615ba1f46.tar.gz |
Merge "Docs for benchmarking Clang's build performance" am: f88052ae38
Original change: https://android-review.googlesource.com/c/platform/prebuilts/clang/host/linux-x86/+/2097194
Change-Id: I9f9c87e3f96db476bf9b6ec5a003bf8c149fc4a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | docs/build_performance.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/build_performance.md b/docs/build_performance.md new file mode 100644 index 000000000..c9b9c13d5 --- /dev/null +++ b/docs/build_performance.md @@ -0,0 +1,37 @@ +# Benchmarking Build Performance of Android Clang + +Build performance is a vital metric as it affects development velocity, CI +resource usage and the headroom for more sophisticated optimisation techniques. +We heavily optimise Android Clang for peak performance. + +The Android Clang's compiler wrapper provides a convenient way to analyse the +time spent building the Android platform. It can be produced by running: + +``` +rm -f /tmp/rusage.txt +TOOLCHAIN_RUSAGE_OUTPUT=/tmp/rusage.txt m -j{processor count / 4} +``` + +We decrease the parallelism to reduce noise caused by resource contention. Also +make sure RBE is off for the build. The resulting `rusage.txt` can be analysed +with the following Python script: + +``` +#! /usr/bin/env python3 + +import json + +total_clang_time = 0 +total_clang_tidy_time = 0 + +with open('/tmp/rusage_bolt.txt', 'r') as rusage: + for line in rusage: + data = json.loads(line) + if 'clang-tidy' in data['compiler']: + total_clang_tidy_time += data['elapsed_real_time'] + else: + total_clang_time += data['elapsed_real_time'] + +print('Total clang time', total_clang_time) +print('Total clang-tidy time', total_clang_tidy_time) +``` |