31
31
import argparse
32
32
import tempfile
33
33
import time
34
+ import re
34
35
35
36
DEFAULT_MIN_DURATION = 0.01
36
- BASELINE_COMMIT = '2149c50' # 0.9.1 + regression fix + vb fixes # TODO: detect upstream/master
37
37
38
38
parser = argparse .ArgumentParser (description = 'Use vbench to generate a report comparing performance between two commits.' )
39
39
parser .add_argument ('-a' , '--auto' ,
40
40
help = 'Execute a run using the defaults for the base and target commits.' ,
41
41
action = 'store_true' ,
42
42
default = False )
43
43
parser .add_argument ('-b' , '--base-commit' ,
44
- help = 'The commit serving as performance baseline (default: %s).' % BASELINE_COMMIT ,
44
+ help = 'The commit serving as performance baseline ' ,
45
45
type = str )
46
46
parser .add_argument ('-t' , '--target-commit' ,
47
47
help = 'The commit to compare against the baseline (default: HEAD).' ,
54
54
metavar = "<file>" ,
55
55
dest = 'log_file' ,
56
56
help = 'path of file in which to save the report (default: vb_suite.log).' )
57
-
57
+ parser .add_argument ('-r' , '--regex' ,
58
+ metavar = "REGEX" ,
59
+ dest = 'regex' ,
60
+ default = "" ,
61
+ help = 'regex pat, only tests whose name matches the regext will be run.' )
58
62
59
63
def get_results_df (db , rev ):
60
64
from pandas import DataFrame
61
65
"""Takes a git commit hash and returns a Dataframe of benchmark results
62
66
"""
63
67
bench = DataFrame (db .get_benchmarks ())
64
- results = DataFrame (db .get_rev_results (rev ).values ())
68
+ results = DataFrame (map ( list , db .get_rev_results (rev ).values () ))
65
69
66
70
# Sinch vbench.db._reg_rev_results returns an unlabeled dict,
67
71
# we have to break encapsulation a bit.
@@ -80,9 +84,6 @@ def main():
80
84
from vbench .db import BenchmarkDB
81
85
from suite import REPO_PATH , BUILD , DB_PATH , PREPARE , dependencies , benchmarks
82
86
83
- if not args .base_commit :
84
- args .base_commit = BASELINE_COMMIT
85
-
86
87
# GitRepo wants exactly 7 character hash?
87
88
args .base_commit = args .base_commit [:7 ]
88
89
if args .target_commit :
@@ -96,6 +97,8 @@ def main():
96
97
prprint ("TMP_DIR = %s" % TMP_DIR )
97
98
prprint ("LOG_FILE = %s\n " % args .log_file )
98
99
100
+ benchmarks = [x for x in benchmarks if re .search (args .regex ,x .name )]
101
+
99
102
try :
100
103
logfile = open (args .log_file , 'w' )
101
104
@@ -218,7 +221,7 @@ def _parse_commit_log(repo_path):
218
221
219
222
if __name__ == '__main__' :
220
223
args = parser .parse_args ()
221
- if not args .auto and not args .base_commit and not args .target_commit :
224
+ if not args .auto and ( not args .base_commit and not args .target_commit ) :
222
225
parser .print_help ()
223
226
else :
224
227
main ()
0 commit comments