Skip to content

Commit a72c2f7

Browse files
chaitanyaenrndokos
authored andcommitted
Add support to run additional scripts after postprocessing
This commit adds a --pbench_post flag in pbench_user_benchmark script. It accepts a path to any script and runs it after postprocessing. A sample use case would be run a binary which will add some files in the result directory.
1 parent 54fcd46 commit a72c2f7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

agent/bench-scripts/pbench-user-benchmark

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ function usage {
4141
printf -- "\t\t --tool-group=str\n"
4242
printf -- "\t\t --sysinfo=str, str = comma separated values of system information to be collected\n"
4343
printf -- "\t\t available: $(pbench-collect-sysinfo --options)\n"
44+
printf -- "\t\t --pbench_post=str path to the script which will be executed after postprocess\n"
4445
}
4546

4647
# Process options and arguments
47-
opts=$(getopt -q -o C:h --longoptions "config:,help,tool-group:,sysinfo:" -n "getopt.sh" -- "$@");
48+
opts=$(getopt -q -o C:h --longoptions "config:,help,tool-group:,sysinfo:,pbench_post:" -n "getopt.sh" -- "$@");
4849
if [ $? -ne 0 ]; then
4950
printf -- "$*\n\n"
5051
printf "\t${benchmark}: you specified an invalid option\n\n"
@@ -76,6 +77,13 @@ while true; do
7677
shift
7778
fi
7879
;;
80+
--pbench_post)
81+
shift
82+
if [ -n "$1" ]; then
83+
pbench_post="$1"
84+
shift
85+
fi
86+
;;
7987
-h|--help)
8088
usage
8189
exit 0
@@ -151,8 +159,13 @@ if [[ $_PBENCH_BENCH_TESTS == 1 ]]; then
151159
benchmark_duration=0
152160
fi
153161
$script_path/postprocess/user-benchmark-wrapper "$benchmark_run_dir" "$benchmark_duration"
162+
154163
pbench-stop-tools --group=$tool_group --iteration=$iteration --dir=$benchmark_results_dir
155164
pbench-postprocess-tools --group=$tool_group --iteration=$iteration --dir=$benchmark_results_dir
156165
pbench-metadata-log --group=$tool_group --dir=$benchmark_run_dir end
166+
if [[ ! -z $pbench_post ]]; then
167+
log "[$script_name]: Running $pbench_post"
168+
$pbench_post
169+
fi
157170
pbench-collect-sysinfo --group=$tool_group --dir=$benchmark_run_dir --sysinfo=$sysinfo end
158171
rmdir $benchmark_results_dir/.running

0 commit comments

Comments
 (0)