aboutsummaryrefslogtreecommitdiff
path: root/utils/utils_benchmarks.sh
diff options
context:
space:
mode:
authorArtem Kotsiuba <artem.kotsiuba@linaro.org>2021-09-16 15:18:25 +0100
committerArtem Kotsiuba <artem.kotsiuba@linaro.org>2021-09-17 14:02:15 +0000
commite753245a16d8265b504cb32793d829738e2d2a39 (patch)
treec0ba2c5d51d14dd9d18a7b3bbe9d962e6acbf6ce /utils/utils_benchmarks.sh
parente9a6c9a5a32d40c68315b2f33590be603932de61 (diff)
downloadart-build-scripts-e753245a16d8265b504cb32793d829738e2d2a39.tar.gz
ART: Move functions that can be reused in other benchmark
scripts to utils file This change moves some functions that can be reused by other benchmark-related scripts (for example compile statistics) to the file utils_benchmark.sh to make work on future patches easier. Test: ./scripts/benchmarks/benchmarks_run_target.sh SystemArrayCopy --iterations 2 --mode 64 --skip-build and ./scripts/benchmarks/test-art-target.sh --default --skip-build Change-Id: Iedaf2604600329e84c6f8461baffdfc0ee4e9f6b
Diffstat (limited to 'utils/utils_benchmarks.sh')
-rw-r--r--utils/utils_benchmarks.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/utils/utils_benchmarks.sh b/utils/utils_benchmarks.sh
index cf36cc6c..c8899c3c 100644
--- a/utils/utils_benchmarks.sh
+++ b/utils/utils_benchmarks.sh
@@ -258,3 +258,48 @@ require_big_little_device() {
get_simpleperf_home() {
echo "$(get_workspace)/system/extras/simpleperf"
}
+
+# Arguments:
+# ${1} - path to devices config
+list_devices_from_config() {
+ log I "--- List of supported devices in devices/config ---"
+ local f
+ for f in $1; do
+ local filename=${f##*/}
+ safe source "$f"
+ log I "${filename%.*}: $DEVICE_NAME"
+ done
+}
+
+# Reads
+set_environment_for_benchmark_run() {
+ local -n bench_options=$1
+ set_environment_target
+ if ${bench_options["linux"]}; then
+ set_environment_linux_target
+ fi
+ if ${bench_options["sudo"]}; then
+ set_environment_use_sudo
+ fi
+ if ${bench_options["x86"]}; then
+ select_android_target "x86" ""
+ else
+ local target_device="${bench_options["target-device"]}"
+
+ # When we actually are to run benchmark on the device and the target device is not specified try
+ # to autodetect it.
+ if [[ "${bench_options["skip-run"]}" == "false" && "${target_device}" == "" ]]; then
+ log I "Retrieve the target device using adb getprop..."
+ # Skip building adb on CI bots: they run inside a container where adb is
+ # already sourced, and the full Android tree is not available.
+ if [[ ! -v SOURCE_BUILD_URL ]]; then
+ prepare_adb
+ fi
+ target_device="$(retrieve_target_product_name)"
+ log I "Target device to be used: ${target_device}."
+ fi
+
+ select_android_target "arm" "${target_device}"
+ fi
+ source_android_environment_default
+}