Skip to content

Commit 7326e72

Browse files
committed
moved the harness to the benchmarks location
1 parent 2b54222 commit 7326e72

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

mx.graalpython/bench_harness.py renamed to graalpython/benchmarks/src/harness.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
# SOFTWARE.
3939

4040
import _io
41-
import argparse
4241
import os
4342
import sys
4443
from time import time
@@ -120,14 +119,31 @@ def run(self):
120119

121120

122121
def run_benchmark(prog, args):
123-
parser = argparse.ArgumentParser(prog=prog, description="Run specified benchmark.")
124-
parser.add_argument("-w", "--warmup", help="The number of iterations to skip as warmup.", default=0)
125-
parser.add_argument("-i", "--iterations", help="The number of iterations top run each benchmark.", default=1)
126-
parser.add_argument("bench_file", metavar='BENCH', help="Path to the benchmark to execute.", nargs=1)
127-
parser.add_argument("bench_args", metavar='ARGS', help="Path to the benchmarks to execute.", nargs='*', default=None)
128-
129-
args = parser.parse_args(args)
130-
BenchRunner(args.bench_file[0], bench_args=args.bench_args, iterations=args.iterations, warmup=args.warmup).run()
122+
warmup = 0
123+
iterations = 1
124+
bench_file = None
125+
bench_args = []
126+
127+
i = 0
128+
while i < len(args):
129+
arg = args[i]
130+
if arg == '-i':
131+
i += 1
132+
iterations = _as_int(args[i])
133+
elif arg.startswith("--iterations"):
134+
iterations = _as_int(arg.split("=")[1])
135+
elif arg == '-w':
136+
i += 1
137+
warmup = _as_int(args[i])
138+
elif arg.startswith("--warmup"):
139+
warmup = _as_int(arg.split("=")[1])
140+
elif bench_file is None:
141+
bench_file = arg
142+
else:
143+
bench_args.append(arg)
144+
i += 1
145+
146+
BenchRunner(bench_file, bench_args=bench_args, iterations=iterations, warmup=warmup).run()
131147

132148

133149
if __name__ == '__main__':

0 commit comments

Comments
 (0)