File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
graalpython/benchmarks/src Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 44
44
45
45
46
46
_HRULE = '-' .join (['' for i in range (80 )])
47
- ATTR_BENCHMARK = '__benchmark__'
47
+
48
+ #: this function is used to pre-process the arguments as expected by the __benchmark__ and __setup__ entry points
48
49
ATTR_PROCESS_ARGS = '__process_args__'
50
+ #: gets called with the preprocessed arguments before __benchmark__
51
+ ATTR_SETUP = '__setup__'
52
+ #: gets called with the preprocessed arguments N times
53
+ ATTR_BENCHMARK = '__benchmark__'
54
+ #: performs any teardown needed in the benchmark
49
55
ATTR_TEARDOWN = '__teardown__'
50
56
51
57
@@ -146,6 +152,10 @@ def run(self):
146
152
print ("### args = %s" % args )
147
153
print (_HRULE )
148
154
155
+ print ("### setup ... " )
156
+ self ._call_attr (ATTR_SETUP , * args )
157
+ print ("### start benchmark ... " )
158
+
149
159
bench_func = self ._get_attr (ATTR_BENCHMARK )
150
160
if bench_func and hasattr (bench_func , '__call__' ):
151
161
if self .warmup :
You can’t perform that action at this time.
0 commit comments