@@ -132,7 +132,6 @@ def _call_attr(self, attr_name, *args):
132
132
return attr (* args )
133
133
134
134
def run (self ):
135
- print (_HRULE )
136
135
if self ._run_once :
137
136
print ("### %s, exactly one iteration (no warmup curves)" % (self .bench_module .__name__ ))
138
137
else :
@@ -163,16 +162,19 @@ def run(self):
163
162
else :
164
163
print ("### iteration=%s, name=%s, duration=%s" % (iteration , self .bench_module .__name__ , duration ))
165
164
166
- print ("teardown ... " )
165
+ print (_HRULE )
166
+ print ("### teardown ... " )
167
167
self ._call_attr (ATTR_TEARDOWN )
168
- print ("benchmark complete" )
168
+ print ("### benchmark complete" )
169
+ print (_HRULE )
169
170
170
171
171
- def run_benchmark (prog , args ):
172
+ def run_benchmark (args ):
172
173
warmup = 0
173
174
iterations = 1
174
175
bench_file = None
175
176
bench_args = []
177
+ paths = []
176
178
177
179
i = 0
178
180
while i < len (args ):
@@ -182,19 +184,36 @@ def run_benchmark(prog, args):
182
184
iterations = _as_int (args [i ])
183
185
elif arg .startswith ("--iterations" ):
184
186
iterations = _as_int (arg .split ("=" )[1 ])
187
+
185
188
elif arg == '-w' :
186
189
i += 1
187
190
warmup = _as_int (args [i ])
188
191
elif arg .startswith ("--warmup" ):
189
192
warmup = _as_int (arg .split ("=" )[1 ])
193
+
194
+ elif arg == '-p' :
195
+ i += 1
196
+ paths = args [i ].split ("," )
197
+ elif arg .startswith ("--path" ):
198
+ paths = arg .split ("=" )[1 ].split ("," )
199
+
190
200
elif bench_file is None :
191
201
bench_file = arg
192
202
else :
193
203
bench_args .append (arg )
194
204
i += 1
195
205
206
+ # set the paths if specified
207
+ print (_HRULE )
208
+ if paths :
209
+ for pth in paths :
210
+ print ("### adding module path: %s" % pth )
211
+ sys .path .append (pth )
212
+ else :
213
+ print ("### no extra module search paths specified" )
214
+
196
215
BenchRunner (bench_file , bench_args = bench_args , iterations = iterations , warmup = warmup ).run ()
197
216
198
217
199
218
if __name__ == '__main__' :
200
- run_benchmark (sys .argv [0 ], sys . argv [ 1 :])
219
+ run_benchmark (sys .argv [1 :])
0 commit comments