summaryrefslogtreecommitdiff
path: root/tcwg-benchmark-results.sh
diff options
context:
space:
mode:
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2021-04-01 16:28:21 +0530
committerPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2021-04-05 15:01:23 +0000
commit591a8fa69de47fdc3876187e0783dc40e32d22e8 (patch)
tree5b01ce7c0263b1b2627e8971f1c94c10b5144ded /tcwg-benchmark-results.sh
parentd3e84bd42ef82b54a1d27adf2540a29610539c35 (diff)
Refactor tcwg_bmk-build.sh and tcwg-benchmark-results.sh for metrics.
The patch adds an option to tcwg-benchmark-results.sh called "metric", and calls corresponding scripts to convert relevant metric-data to csv files. And adds metric to rr in tcwg_bmk-build.sh, which is set to "perf" by default. The rationale behind this change is to refactor the scripts to simplify adding more metrics in future. Change-Id: I3dfd2a572faeea4b0034fe6a6bb635824b3d60c3
Diffstat (limited to 'tcwg-benchmark-results.sh')
-rwxr-xr-xtcwg-benchmark-results.sh68
1 files changed, 46 insertions, 22 deletions
diff --git a/tcwg-benchmark-results.sh b/tcwg-benchmark-results.sh
index dee59a01..5fa3e160 100755
--- a/tcwg-benchmark-results.sh
+++ b/tcwg-benchmark-results.sh
@@ -8,6 +8,34 @@ scripts=$(dirname $0)
# shellcheck source=jenkins-helpers.sh
. $scripts/jenkins-helpers.sh
+function gather_perf_data ()
+{
+ local has_perf_logs=$1
+ local hw_tag=$2
+ local num=$3
+
+ if [ x"$has_perf_logs" = xyes ]; then
+ $scripts/../bmk-scripts/perfdatadir2csv.sh \
+ --buildid-dir local --format sample,size --sort-field sample \
+ --perf-bin /usr/lib/linux-tools/$hw_tag/perf \
+ $verbose_opt $num_entries_opt \
+ --results-dir "results-$num/" > "$top_artifacts/results-$num.csv"
+ else
+ # No perf logs to parse, just copy the plain results.csv.
+ # Use 'find' because results.csv is located under
+ # results-$num/NODE_NAME/ and we don't want to hardcode
+ # NODE_NAME. Since the whole script runs under 'set -f', using
+ # '*' does not work.
+ mapfile -t this_csv < <(find results-$num -name results.csv)
+ if [ "${#this_csv[@]}" -eq 1 ]; then
+ cp -v "${this_csv[@]}" "$top_artifacts/results-$num.csv"
+ else
+ echo "ERROR: Found ${#this_csv[@]} CSV results files in results-$num, expecting a single one."
+ exit 1
+ fi
+ fi
+}
+
convert_args_to_variables "$@"
obligatory_variables results
@@ -17,7 +45,12 @@ verbose="${verbose-false}"
# shellcheck disable=SC2154
num_entries_opt="${num_dsos+--num-dsos $num_dsos} ${num_symbols+--num-symbols $num_symbols}"
entry_threshold="${entry_threshold-5}"
-has_perf_logs="${has_perf_logs-yes}"
+metric="${metric-perf}"
+has_perf_logs="${has_perf_logs-no}"
+
+if [ x"$metric" = x"perf" ]; then
+ has_perf_logs="yes"
+fi
verbose_opt=""
if $verbose; then
@@ -42,27 +75,18 @@ results_top="bkp-01.tcwglab:/home/tcwg-benchmark/results"
csvs=""
for i in "${results[@]}"; do
rsync -az --delete "$results_top-$i/" results-$num/
- hw_tag="${i%%/*}"
- if [ x"$has_perf_logs" = xyes ]; then
- $scripts/../bmk-scripts/perfdatadir2csv.sh \
- --buildid-dir local --format sample,size --sort-field sample \
- --perf-bin /usr/lib/linux-tools/$hw_tag/perf \
- $verbose_opt $num_entries_opt \
- --results-dir "results-$num/" > "$top_artifacts/results-$num.csv"
- else
- # No perf logs to parse, just copy the plain results.csv.
- # Use 'find' because results.csv is located under
- # results-$num/NODE_NAME/ and we don't want to hardcode
- # NODE_NAME. Since the whole script runs under 'set -f', using
- # '*' does not work.
- mapfile -t this_csv < <(find results-$num -name results.csv)
- if [ "${#this_csv[@]}" -eq 1 ]; then
- cp -v "${this_csv[@]}" "$top_artifacts/results-$num.csv"
- else
- echo "ERROR: Found ${#this_csv[@]} CSV results files in results-$num, expecting a single one."
- exit 1
- fi
- fi
+
+ case $metric in
+ "perf")
+ hw_tag="${i%%/*}"
+ gather_perf_data $has_perf_logs $hw_tag $num
+ ;;
+ *)
+ echo "ERROR: invalid value for metric: ${metric}"
+ exit 1
+ ;;
+ esac
+
csvs="$csvs $top_artifacts/results-$num.csv"
num=$(($num+1))
done