@@ -2033,3 +2033,73 @@ def run(self, benchmarks, bmSuiteArgs):
20332033
20342034
20352035mx_benchmark .add_bm_suite (AWFYBenchmarkSuite ())
2036+
2037+
2038+ _consoleConfig = {
2039+ "helloworld" : {
2040+ "mainClass" : "bench.console.HelloWorld" ,
2041+ "args" : []
2042+ },
2043+ "scalafmt" : {
2044+ "mainClass" : "bench.console.Scalafmt" ,
2045+ "args" : []
2046+ }
2047+ }
2048+
2049+ class ConsoleBenchmarkSuite (mx_benchmark .JavaBenchmarkSuite ):
2050+ """Hello World benchmark suite implementation.
2051+ """
2052+ def name (self ):
2053+ return "console"
2054+
2055+ def group (self ):
2056+ return "Graal"
2057+
2058+ def subgroup (self ):
2059+ return "graal-compiler"
2060+
2061+ def benchSuiteName (self , bmSuiteArgs = None ):
2062+ return self .name ()
2063+
2064+ def helloWorldPath (self ):
2065+ helloWorld = mx .distribution ("GRAAL_BENCH_CONSOLE" )
2066+ if helloWorld :
2067+ return helloWorld .path
2068+ return None
2069+
2070+ def classpathAndMainClass (self , benchmark ):
2071+ main_class = _consoleConfig .get (benchmark )["mainClass" ]
2072+ return ["-cp" , self .helloWorldPath (), main_class ]
2073+
2074+ def appArgs (self , benchmark ):
2075+ return _consoleConfig .get (benchmark )["args" ]
2076+
2077+ def createCommandLineArgs (self , benchmarks , bmSuiteArgs ):
2078+ if benchmarks is None :
2079+ mx .abort ("Suite can only run a single benchmark per VM instance." )
2080+ elif len (benchmarks ) != 1 :
2081+ mx .abort ("Must specify exactly one benchmark to run." )
2082+ elif benchmarks [0 ] not in self .benchmarkList (bmSuiteArgs ):
2083+ mx .abort ("The specified benchmark doesn't exist. Possible values are: " + ", " .join (self .benchmarkList (bmSuiteArgs )))
2084+ vmArgs = self .runArgs (bmSuiteArgs )
2085+ runArgs = self .runArgs (bmSuiteArgs )
2086+ appArgs = self .appArgs (benchmarks [0 ])
2087+ return (vmArgs + self .classpathAndMainClass (benchmarks [0 ]) + runArgs + appArgs )
2088+
2089+ def benchmarkList (self , bmSuiteArgs ):
2090+ return sorted (_consoleConfig .keys ())
2091+
2092+ def successPatterns (self ):
2093+ return []
2094+
2095+ def failurePatterns (self ):
2096+ return [
2097+ re .compile (
2098+ r"^\[\[\[Graal compilation failure\]\]\]" , # pylint: disable=line-too-long
2099+ re .MULTILINE )
2100+ ]
2101+
2102+ def rules (self , output , benchmarks , bmSuiteArgs ):
2103+ return []
2104+
2105+ mx_benchmark .add_bm_suite (ConsoleBenchmarkSuite ())
0 commit comments