3030
3131import mx
3232from 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
3434
3535# ----------------------------------------------------------------------------------------------------------------------
3636#
5252SUBGROUP_GRAAL_PYTHON = "graalpython"
5353PYTHON_VM_REGISTRY_NAME = "Python"
5454CONFIGURATION_DEFAULT = "default"
55- _HRULE = '' .join (['-' for _ in range (120 )])
5655
5756
5857# ----------------------------------------------------------------------------------------------------------------------
6160#
6261# ----------------------------------------------------------------------------------------------------------------------
6362def _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 ))
7065
7166
7267# ----------------------------------------------------------------------------------------------------------------------
@@ -180,8 +175,13 @@ def config_name(self):
180175#
181176# ----------------------------------------------------------------------------------------------------------------------
182177class PythonBenchmarkSuite (VmBenchmarkSuite ):
183- def __init__ (self , name ):
178+ def __init__ (self , name , harness_path ):
184179 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+
185185 self ._bench_path , self ._benchmarks = benchmarks_list [self ._name ]
186186 self ._bench_path = join (_graalpython_suite .dir , self ._bench_path )
187187
@@ -190,10 +190,11 @@ def rules(self, output, benchmarks, bm_suite_args):
190190 arg = " " .join (self ._benchmarks [bench_name ])
191191 return [
192192 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
194194 {
195195 "benchmark" : '{}.{}' .format (self ._name , bench_name ),
196196 "metric.name" : "time" ,
197+ "metric.iteration" : ("<iteration>" , int ),
197198 "metric.type" : "numeric" ,
198199 "metric.value" : ("<time>" , float ),
199200 "metric.unit" : "s" ,
@@ -211,8 +212,8 @@ def createVmCommandLineArgs(self, benchmarks, run_args):
211212
212213 benchmark = benchmarks [0 ]
213214
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 :
216217 cmd_args .extend (self ._benchmarks [benchmark ])
217218 else :
218219 cmd_args .extend (run_args )
@@ -228,7 +229,7 @@ def benchmarks(self):
228229
229230 def successPatterns (self ):
230231 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
232233 ]
233234
234235 def failurePatterns (self ):
@@ -250,7 +251,7 @@ def get_vm_registry(self):
250251
251252 @classmethod
252253 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 ]
254255
255256
256257# ----------------------------------------------------------------------------------------------------------------------
0 commit comments