30
30
31
31
import mx
32
32
from mx_benchmark import StdOutRule , VmRegistry , java_vm_registry , Vm , GuestVm , VmBenchmarkSuite
33
- from mx_graalpython_bench_param import benchmarks_list
33
+ from mx_graalpython_bench_param import benchmarks_list , harnessPath
34
34
35
35
# ----------------------------------------------------------------------------------------------------------------------
36
36
#
52
52
SUBGROUP_GRAAL_PYTHON = "graalpython"
53
53
PYTHON_VM_REGISTRY_NAME = "Python"
54
54
CONFIGURATION_DEFAULT = "default"
55
- _HRULE = '' .join (['-' for _ in range (120 )])
56
55
57
56
58
57
# ----------------------------------------------------------------------------------------------------------------------
61
60
#
62
61
# ----------------------------------------------------------------------------------------------------------------------
63
62
def _check_vm_args (name , args ):
64
- if len (args ) != 1 :
65
- mx .abort ("Expected only a single benchmark path, got {} instead" .format (args ))
66
- benchmark_name = os .path .basename (os .path .splitext (args [0 ])[0 ])
67
- print (_HRULE )
68
- print (name , benchmark_name )
69
- print (_HRULE )
63
+ if len (args ) < 2 :
64
+ mx .abort ("Expected at least 2 args (a single benchmark path in addition to the harness), got {} instead" .format (args ))
70
65
71
66
72
67
# ----------------------------------------------------------------------------------------------------------------------
@@ -180,8 +175,13 @@ def config_name(self):
180
175
#
181
176
# ----------------------------------------------------------------------------------------------------------------------
182
177
class PythonBenchmarkSuite (VmBenchmarkSuite ):
183
- def __init__ (self , name ):
178
+ def __init__ (self , name , harness_path ):
184
179
self ._name = name
180
+ self ._harness_path = harness_path
181
+ self ._harness_path = join (_graalpython_suite .dir , self ._harness_path )
182
+ if not self ._harness_path :
183
+ mx .abort ("python harness path not specified!" )
184
+
185
185
self ._bench_path , self ._benchmarks = benchmarks_list [self ._name ]
186
186
self ._bench_path = join (_graalpython_suite .dir , self ._bench_path )
187
187
@@ -190,10 +190,11 @@ def rules(self, output, benchmarks, bm_suite_args):
190
190
arg = " " .join (self ._benchmarks [bench_name ])
191
191
return [
192
192
StdOutRule (
193
- r"^(?P<benchmark>[a-zA-Z0-9\ .\-]+): (?P<time>[0-9]+(\.[0-9]+)?$)" , # pylint: disable=line-too-long
193
+ r"^### iteration= (?P<iteration>[0-9]+), name=(?P< benchmark>[a-zA-Z0-9.\-]+), duration= (?P<time>[0-9]+(\.[0-9]+)?$)" , # pylint: disable=line-too-long
194
194
{
195
195
"benchmark" : '{}.{}' .format (self ._name , bench_name ),
196
196
"metric.name" : "time" ,
197
+ "metric.iteration" : ("<iteration>" , int ),
197
198
"metric.type" : "numeric" ,
198
199
"metric.value" : ("<time>" , float ),
199
200
"metric.unit" : "s" ,
@@ -211,8 +212,8 @@ def createVmCommandLineArgs(self, benchmarks, run_args):
211
212
212
213
benchmark = benchmarks [0 ]
213
214
214
- cmd_args = [join (self ._bench_path , "{}.py" .format (benchmark ))]
215
- if len (run_args ) ! = 0 :
215
+ cmd_args = [self . _harness_path , join (self ._bench_path , "{}.py" .format (benchmark ))]
216
+ if len (run_args ) = = 0 :
216
217
cmd_args .extend (self ._benchmarks [benchmark ])
217
218
else :
218
219
cmd_args .extend (run_args )
@@ -228,7 +229,7 @@ def benchmarks(self):
228
229
229
230
def successPatterns (self ):
230
231
return [
231
- re .compile (r"^(?P<benchmark>[a-zA-Z0-9.\-]+): (?P<score >[0-9]+(\.[0-9]+)?$)" , re .MULTILINE )
232
+ re .compile (r"^### iteration= (?P<iteration>[0-9]+), name=(?P< benchmark>[a-zA-Z0-9.\-]+), duration= (?P<time >[0-9]+(\.[0-9]+)?$)" , re .MULTILINE ) # pylint: disable=line-too-long
232
233
]
233
234
234
235
def failurePatterns (self ):
@@ -250,7 +251,7 @@ def get_vm_registry(self):
250
251
251
252
@classmethod
252
253
def get_benchmark_suites (cls ):
253
- return [cls (suite_name ) for suite_name in benchmarks_list ]
254
+ return [cls (suite_name , harnessPath ) for suite_name in benchmarks_list ]
254
255
255
256
256
257
# ----------------------------------------------------------------------------------------------------------------------
0 commit comments