aboutsummaryrefslogtreecommitdiff
path: root/scripts/incremental_build/canonical_perf.sh
blob: 97e47d4318595c8e443bd558e295b4fa7c7a8c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#
# Copyright (C) 2022 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Gather and print top-line performance metrics for the android build
#
readonly TOP="$(realpath "$(dirname "$0")/../../../..")"

usage() {
  cat <<EOF
usage: $0 [-l LOG_DIR] [BUILD_TYPES]
  -l    LOG_DIR should be outside of source tree, including not in out/,
        because the whole tree will be cleaned during testing.
example:
 $0 soong prod
EOF
  exit 1
}

declare -a build_types
while getopts "l:" opt; do
  case "$opt" in
  l) log_dir=$OPTARG ;;
  ?) usage ;;
  esac
done
shift $((OPTIND - 1))
readonly -a build_types=("$@")

log_dir=${log_dir:-"$TOP/../timing-$(date +%b%d-%H%M)"}

function build() {
  date
  set -x
  if ! "$TOP/build/bazel/scripts/incremental_build/incremental_build.sh" \
    --ignore-repo-diff --log-dir "$log_dir" \
    ${build_types:+--build-types "${build_types[@]}"} \
    "$@"; then
    echo "See logs for errors"
    exit 1
  fi
  set +x
}
build --cujs clean 'create bionic/unreferenced.txt' 'modify Android.bp' -- droid
build --cujs 'modify bionic/.*/stdio.cpp' --append-csv libc
build --cujs 'modify .*/adb/daemon/main.cpp' --append-csv adbd
build --cujs 'modify frameworks/.*/View.java' --append-csv framework