Skip to content

Commit 30528df

Browse files
committed
feat: Add benchmark flag to limit what benchmarks pyperformance runs
1 parent 6afb07d commit 30528df

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

pyperf/pyperf_run

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ install_pip=0
2323
PYTHON_VERSION=""
2424
PYPERF_VERSION="1.11.0"
2525
copy_dirs=""
26+
benchmarks="all"
2627

2728
base_dir=$(dirname $(realpath $0))
2829
#
@@ -46,6 +47,7 @@ usage()
4647
echo "--pyperf_version <version number>: Version of pyperf to run, default is $PYPERF_VERSION."
4748
echo "--python_exec_path: Python to set via alternatives"
4849
echo "--python_pkgs: comma seprated list of python packages to install"
50+
echo "--pyperf_benchmarks: Comma separated list of pyperformance benchmarks to run. Default is to run all tests."
4951
source test_tools/general_setup --usage
5052
exit 1
5153
}
@@ -255,6 +257,7 @@ ARGUMENT_LIST=(
255257
"pyperf_version"
256258
"python_exec"
257259
"python_pkgs"
260+
"pyperf_benchmarks"
258261
)
259262

260263
NO_ARGUMENTS=(
@@ -291,6 +294,10 @@ while [[ $# -gt 0 ]]; do
291294
install_pip=1
292295
shift 1
293296
;;
297+
--pyperf_benchmarks)
298+
benchmarks=$2
299+
shift 2
300+
;;
294301
--usage)
295302
usage $0
296303
;;
@@ -351,7 +358,12 @@ if [[ $to_use_pcp -eq 1 ]]; then
351358
copy_dirs="$pcp_dir"
352359
fi
353360

354-
$python_exec -m pyperformance run --output ${pyresults}.json
361+
pyperf_flags=""
362+
if [[ "$benchmarks" != "all" ]]; then
363+
pyperf_flags="-b $benchmarks"
364+
fi
365+
366+
$python_exec -m pyperformance run --output ${pyresults}.json $pyperf_flags
355367
if [ $? -ne 0 ]; then
356368
exit_out "Failed: $python_exec -m pyperformance run --output ${pyresults}.json" 1
357369
fi

0 commit comments

Comments
 (0)