From cba52c6e6b01b912cc20c3efc474798aec823296 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 10 Feb 2022 15:13:01 +0000 Subject: Support new CPU structure format for benchmarks Change benchmark device config files to use a new generalised CPU structure. The new structure uses a "2d" associative array to define the CPU ID's, grouped into separate clusters, and associates them with a frequency. To support these changes to config files, changes have also been made to the benchmarking, and supporting utility scripts. This includes allowing a cluster name to be given as an argument to each script to replace the old "--cpu " and "--" options. The new cluster name is checked against the device config at run time. Test: ./scripts/benchmarks/benchmarks_run_target.sh --cpu little \ --iterations 2 benchmarks/algorithm/DeltaBlue Test: ./scripts/benchmarks/perf_profile_benchmarks_target.sh \ --cpu big benchmarks/algorithm/DeltaBlue Test: ./scripts/benchmarks/compilation_stats_target.sh --cpu middle \ ./external-benchmarks/apks/DuckDuckGo/duckduckgo-5.97.0-play-release.apk \ boot.oat --iterations 2 Change-Id: Id8456f03bed7b35ea8fabfff96add78184ce74cf --- benchmarks/benchmarks_run_target.sh | 23 ++-- benchmarks/calibrate_benchmark_target.sh | 36 ++---- benchmarks/compilation_stats_target.sh | 18 ++- benchmarks/perf_profile_benchmarks_target.sh | 12 +- devices/config/NUC6i5SYH.sh | 27 +++-- devices/config/VOYOv1.sh | 27 +++-- devices/config/angler.sh | 35 ++++-- devices/config/blueline.sh | 37 ++++--- devices/config/bullhead.sh | 35 ++++-- devices/config/flame.sh | 37 ++++--- devices/config/flounder.sh | 27 +++-- devices/config/fugu.sh | 27 +++-- devices/config/hikey960.sh | 37 ++++--- devices/config/sailfish.sh | 27 +++-- devices/config/walleye.sh | 37 ++++--- devices/cpu_freq_utils.sh | 159 ++++++++++++++++++++------- devices/flash_device.sh | 3 +- devices/set_cpu_freq.sh | 114 ++++++++++--------- perf/sperf_target_dalvikvm.sh | 47 ++++---- utils/utils_benchmarks.sh | 33 ------ 20 files changed, 479 insertions(+), 319 deletions(-) diff --git a/benchmarks/benchmarks_run_target.sh b/benchmarks/benchmarks_run_target.sh index bc3a621a..d550aa59 100755 --- a/benchmarks/benchmarks_run_target.sh +++ b/benchmarks/benchmarks_run_target.sh @@ -57,8 +57,12 @@ declare -a benchmarks=() validate_options() { local -r mode="${options["mode"]}" validate_mode_option "${mode}" + local -r cpu="${options["cpu"]}" - validate_cpu_option "${cpu}" + if ! [[ ${cpu} == "all" || ${cpu} == "default" ]]; then + validate_cluster "${cpu}" + fi + local -r iterations="${options["iterations"]}" if [[ ! ${iterations} =~ ^[0-9]+$ ]]; then log E "Invalid number of iterations: ${iterations}" @@ -106,15 +110,12 @@ usage() { log I " --list-devices - List the devices supported by this script." log I " --mode - Run benchmarks for the specified mode(s)." log I " (default: all)" - log I " --cpu - CPU mode." - log I " \"big\": Run with only big cores and pin their frequency" - log I " \"little\": Run with only little cores and pin their" - log I " frequency" - log I " \"all\": With big.LITTLE devices:" - log I " Run consecutively with only little cores enabled and pinned," - log I " and then with only big cores enabled and pinned." - log I " For devices without big.LITTLE, all cores are enabled and" - log I " pinned" + log I " --cpu - CPU mode." + log I " \"cluster_name\": Run with only cores specified by" + log I " \`cluster_name\` and pin their frequency." + log I " \"all\": Run one cluster of cores at a time until all" + log I " clusters/cores have been run. Each cluster is run pinned to" + log I " a specific frequency to ensure consistency between tests." log I " \"default\": Run with unaltered default CPU configuration" log I " (no pinning)." log I " (default: all)" @@ -272,7 +273,7 @@ run_benchmarks() { # ${1} - CPU mode (bitness) run_all_benchmarks() { local -r bitness="$1" - local -r target_device=$(safe adb_shell getprop ro.product.device) + local -r target_device=$(retrieve_target_product_name) local -r cpu="${options["cpu"]}" local -r path_to_devices="${local_path}/../devices" set_freq_and_run run_benchmarks "${bitness}" "${cpu}" "${target_device}" "${path_to_devices}" diff --git a/benchmarks/calibrate_benchmark_target.sh b/benchmarks/calibrate_benchmark_target.sh index 6c9bcc98..50f2c573 100755 --- a/benchmarks/calibrate_benchmark_target.sh +++ b/benchmarks/calibrate_benchmark_target.sh @@ -54,15 +54,7 @@ set_default_options() { } validate_options() { - if [[ -z "${options["cpu"]}" ]]; then - log E "CPU is not provided." - exit 1 - fi - if [[ "${options["cpu"]}" != @(big|little) ]]; then - log E "Invalid CPU option: ${cpu}" - exit 1 - fi - + validate_cluster "${options["cpu"]}" validate_benchmarks_names "${options["benchmark"]}" } @@ -74,10 +66,10 @@ usage() { log I "" log I "-------------------------------------------" log I " -h, --help - help" - log I " --cpu - CPU mode." - log I " 'big': Run dalvikvm on big cores." - log I " 'little': Run dalvikvm on little cores." - log I " Note: The frequency of the specified cores will be pinned." + log I " --cpu - Cluster name." + log I " Run dalvikvm on the cluster specified by" + log I " cluster_name." + log I " Note: The frequency of the specified cores will be pinned." log I " --classpath - Classpath for dalvikvm on a target device." log I " --target_running_time