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 4444
4545
4646_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
4849ATTR_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
4955ATTR_TEARDOWN = '__teardown__'
5056
5157
@@ -146,6 +152,10 @@ def run(self):
146152 print ("### args = %s" % args )
147153 print (_HRULE )
148154
155+ print ("### setup ... " )
156+ self ._call_attr (ATTR_SETUP , * args )
157+ print ("### start benchmark ... " )
158+
149159 bench_func = self ._get_attr (ATTR_BENCHMARK )
150160 if bench_func and hasattr (bench_func , '__call__' ):
151161 if self .warmup :
You can’t perform that action at this time.
0 commit comments