Skip to content

Commit 8688a31

Browse files
committed
[libc++] Allow passing arguments to GoogleBenchmark's compare.py tool
1 parent 48803bc commit 8688a31

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

libcxx/utils/libcxx-compare-benchmarks

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ MONOREPO_ROOT="$(realpath $(dirname "${PROGNAME}"))"
77
function usage() {
88
cat <<EOF
99
Usage:
10-
${PROGNAME} [-h|--help] <baseline-build> <candidate-build> benchmarks...
10+
${PROGNAME} [-h|--help] <baseline-build> <candidate-build> benchmarks... [-- gbench-args...]
1111
1212
Compare the given benchmarks between the baseline and the candidate build directories.
1313
1414
This requires those benchmarks to have already been generated in both build directories.
1515
16-
<baseline-build> The path to the build directory considered the baseline.
17-
<candidate-build> The path to the build directory considered the candidate.
18-
benchmarks... Paths of the benchmarks to compare. Those paths are relative to '<monorepo-root>'.
16+
<baseline-build> The path to the build directory considered the baseline.
17+
<candidate-build> The path to the build directory considered the candidate.
18+
benchmarks... Paths of the benchmarks to compare. Those paths are relative to '<monorepo-root>'.
19+
[-- gbench-args...] Any arguments provided after '--' will be passed as-is to GoogleBenchmark's compare.py tool.
1920
2021
Example
2122
=======
@@ -45,7 +46,17 @@ python3 -m venv /tmp/libcxx-compare-benchmarks-venv
4546
source /tmp/libcxx-compare-benchmarks-venv/bin/activate
4647
pip3 install -r ${GBENCH}/tools/requirements.txt
4748

48-
for benchmark in ${@}; do
49+
benchmarks=""
50+
while [[ $# -gt 0 ]]; do
51+
if [[ "${1}" == "--" ]]; then
52+
shift
53+
break
54+
fi
55+
benchmarks+=" ${1}"
56+
shift
57+
done
58+
59+
for benchmark in ${benchmarks}; do
4960
base="$(${MONOREPO_ROOT}/libcxx/utils/libcxx-benchmark-json ${baseline} ${benchmark})"
5061
cand="$(${MONOREPO_ROOT}/libcxx/utils/libcxx-benchmark-json ${candidate} ${benchmark})"
5162

@@ -58,5 +69,5 @@ for benchmark in ${@}; do
5869
continue
5970
fi
6071

61-
"${GBENCH}/tools/compare.py" benchmarks "${base}" "${cand}"
72+
"${GBENCH}/tools/compare.py" benchmarks "${base}" "${cand}" ${@}
6273
done

0 commit comments

Comments
 (0)