Commit d083da37 authored by Elvis Pranskevichus's avatar Elvis Pranskevichus

Add support for regexps in benchmark selection

parent 45477526
......@@ -5,6 +5,7 @@ import argparse
import json
import os
import os.path
import re
import socket
import subprocess
import sys
......@@ -279,7 +280,8 @@ def main():
parser.add_argument('--duration', '-D', default=30, type=int,
help='duration of each benchmark in seconds')
parser.add_argument('--benchmarks', type=str,
help='comma-separated list of benchmarks to run')
help='comma-separated list of benchmarks to run ' +
'(regular expressions are supported)')
parser.add_argument('--concurrency-levels', type=int, default=[10],
nargs='+',
help='a list of concurrency levels to use')
......@@ -295,9 +297,10 @@ def main():
os.mkdir(_socket)
if args.benchmarks:
benchmarks_to_run = args.benchmarks.split(',')
benchmarks_to_run = [re.compile(b) for b in args.benchmarks.split(',')]
else:
benchmarks_to_run = {b['name'] for b in benchmarks}
benchmarks_to_run = [re.compile(re.escape(b['name']))
for b in benchmarks]
benchmarks_data = []
......@@ -322,7 +325,7 @@ def main():
'--concurrency={}'.format(warmup_concurrency)]
for benchmark in benchmarks:
if benchmark['name'] not in benchmarks_to_run:
if not any(b.match(benchmark['name']) for b in benchmarks_to_run):
continue
print(benchmark['title'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment