@@ -20,16 +20,29 @@ module Utilities
2020 '../../graal/graalvm-jdk1.8.0/bin/java' # This is where I (CS) keep it
2121 ] . compact . map { |path | File . expand_path ( path , JRUBY_DIR ) }
2222
23+ BENCH_LOCATIONS = [
24+ ENV [ 'BENCH_DIR' ] ,
25+ '../bench9000'
26+ ] . compact . map { |path | File . expand_path ( path , JRUBY_DIR ) }
27+
2328 def self . find_graal
2429 not_found = -> {
25- # TODO(CS 24-Jan-15) download it?
26- raise "coudln't find graal"
30+ raise "couldn't find graal - download it from http://lafo.ssw.uni-linz.ac.at/graalvm/ and extract it into the parent directory"
2731 }
2832 GRAAL_LOCATIONS . find ( not_found ) do |location |
2933 File . executable? ( location )
3034 end
3135 end
3236
37+ def self . find_bench
38+ not_found = -> {
39+ raise "couldn't find bench9000 - clone it from https://github.com/jruby/bench9000.git into the parent directory"
40+ }
41+ BENCH_LOCATIONS . find ( not_found ) do |location |
42+ Dir . exist? ( location )
43+ end
44+ end
45+
3346end
3447
3548module ShellUtils
@@ -82,6 +95,10 @@ def help
8295 puts 'jt tag spec/ruby/language/while_spec.rb tag failing specs in this file'
8396 puts 'jt untag spec/ruby/language untag passing specs in this directory'
8497 puts 'jt untag spec/ruby/language/while_spec.rb untag passing specs in this file'
98+ puts 'jt bench reference [benchmarks] run a set of benchmarks and record a reference point'
99+ puts 'jt bench compare [benchmarks] run a set of benchmarks and compare against a reference point'
100+ puts ' benchmarks can be any benchmarks of group of benchmarks supported'
101+ puts ' by bench9000, eg all, classic, chunky, 3, 5, 10, 15 - default is 5'
85102 puts 'jt findbugs run findbugs'
86103 puts 'jt findbugs report run findbugs and generate an HTML report'
87104 puts
@@ -154,6 +171,25 @@ def untag(path, *args)
154171 mspec 'tag' , '--del' , 'fails' , '--pass' , path , *args
155172 end
156173
174+ def bench ( command , *args )
175+ bench_dir = Utilities . find_bench
176+ env_vars = {
177+ "JRUBY_9000_DEV_DIR" => JRUBY_DIR ,
178+ "GRAAL_BIN" => Utilities . find_graal ,
179+ }
180+ args << "5" if args . empty?
181+ bench_args = [ "-I#{ bench_dir } /lib" , "#{ bench_dir } /bin/bench" ]
182+ case command
183+ when 'reference'
184+ bench_args += [ 'reference' , 'jruby-9000-dev-truffle-graal' , '--show-commands' ]
185+ when 'compare'
186+ bench_args += [ 'compare-reference' , 'jruby-9000-dev-truffle-graal' ]
187+ else
188+ raise ArgumentError , command
189+ end
190+ raw_sh env_vars , "ruby" , *bench_args , *args
191+ end
192+
157193 def findbugs ( report = nil )
158194 case report
159195 when 'report'
0 commit comments