@@ -445,6 +445,9 @@ def main():
445
445
parser .add_argument ('--benchmarks' , type = str ,
446
446
help = 'comma-separated list of benchmarks to run ' +
447
447
'(regular expressions are supported)' )
448
+ parser .add_argument ('type' , type = str ,
449
+ choices = {b ['name' ].split ('-' , 1 )[0 ] for b in benchmarks },
450
+ help = 'type of benchmark to run' )
448
451
parser .add_argument ('--concurrency-levels' , type = int , default = [10 ],
449
452
nargs = '+' ,
450
453
help = 'a list of concurrency levels to use' )
@@ -461,11 +464,14 @@ def main():
461
464
if not os .path .exists (_socket ):
462
465
os .mkdir (_socket )
463
466
467
+ benchmarks_to_run = [b for b in benchmarks
468
+ if b ['name' ].startswith (args .type )]
464
469
if args .benchmarks :
465
- benchmarks_to_run = [re .compile (b ) for b in args .benchmarks .split (',' )]
466
- else :
467
- benchmarks_to_run = [re .compile (re .escape (b ['name' ]))
468
- for b in benchmarks ]
470
+ patterns = [re .compile (p ) for p in args .benchmarks .split (',' )]
471
+ benchmarks_to_run = [
472
+ b
473
+ for b in benchmarks_to_run
474
+ if any (p .match (b ['name' ]) for p in patterns )]
469
475
470
476
benchmarks_data = []
471
477
@@ -489,10 +495,7 @@ def main():
489
495
warmup = ['--msize=1024' , '--duration=10' ,
490
496
'--concurrency={}' .format (warmup_concurrency )]
491
497
492
- for benchmark in benchmarks :
493
- if not any (b .match (benchmark ['name' ]) for b in benchmarks_to_run ):
494
- continue
495
-
498
+ for benchmark in benchmarks_to_run :
496
499
print (benchmark ['title' ])
497
500
print ('=' * len (benchmark ['title' ]))
498
501
print ()
0 commit comments