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 ...@@ -5,6 +5,7 @@ import argparse
import json import json
import os import os
import os.path import os.path
import re
import socket import socket
import subprocess import subprocess
import sys import sys
...@@ -279,7 +280,8 @@ def main(): ...@@ -279,7 +280,8 @@ def main():
parser.add_argument('--duration', '-D', default=30, type=int, parser.add_argument('--duration', '-D', default=30, type=int,
help='duration of each benchmark in seconds') help='duration of each benchmark in seconds')
parser.add_argument('--benchmarks', type=str, 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], parser.add_argument('--concurrency-levels', type=int, default=[10],
nargs='+', nargs='+',
help='a list of concurrency levels to use') help='a list of concurrency levels to use')
...@@ -295,9 +297,10 @@ def main(): ...@@ -295,9 +297,10 @@ def main():
os.mkdir(_socket) os.mkdir(_socket)
if args.benchmarks: if args.benchmarks:
benchmarks_to_run = args.benchmarks.split(',') benchmarks_to_run = [re.compile(b) for b in args.benchmarks.split(',')]
else: 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 = [] benchmarks_data = []
...@@ -322,7 +325,7 @@ def main(): ...@@ -322,7 +325,7 @@ def main():
'--concurrency={}'.format(warmup_concurrency)] '--concurrency={}'.format(warmup_concurrency)]
for benchmark in benchmarks: 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 continue
print(benchmark['title']) 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