@@ -132,25 +132,30 @@ class BenchmarkDriver(object):
132
132
return sorted (list (
133
133
benchmarks .intersection (set (self .all_tests )).union (indexed_names )))
134
134
135
- def run (self , test , num_samples = None , num_iters = None ,
136
- verbose = None , measure_memory = False , quantile = None ):
135
+ def run (self , test = None , num_samples = None , num_iters = None ,
136
+ sample_time = None , verbose = None , measure_memory = False ,
137
+ quantile = None ):
137
138
"""Execute benchmark and gather results."""
138
139
num_samples = num_samples or 0
139
140
num_iters = num_iters or 0 # automatically determine N to run for 1s
141
+ sample_time = sample_time or 0 # default is 1s
140
142
141
143
cmd = self ._cmd_run (
142
- test , num_samples , num_iters , verbose , measure_memory , quantile )
144
+ test , num_samples , num_iters , sample_time ,
145
+ verbose , measure_memory , quantile )
143
146
output = self ._invoke (cmd )
144
147
result = self .parser .results_from_string (output ).items ()[0 ][1 ]
145
148
return result
146
149
147
- def _cmd_run (self , test , num_samples , num_iters , verbose , measure_memory ,
148
- quantile ):
150
+ def _cmd_run (self , test , num_samples , num_iters , sample_time ,
151
+ verbose , measure_memory , quantile ):
149
152
cmd = [self .test_harness , test ]
150
153
if num_samples > 0 :
151
154
cmd .append ('--num-samples={0}' .format (num_samples ))
152
155
if num_iters > 0 :
153
156
cmd .append ('--num-iters={0}' .format (num_iters ))
157
+ if sample_time > 0 :
158
+ cmd .append ('--sample-time={0}' .format (sample_time ))
154
159
if verbose :
155
160
cmd .append ('--verbose' )
156
161
if measure_memory :
0 commit comments