4141 args . num_long_runs = v . to_i
4242 end
4343
44- opts . on ( "--category=headline,other,micro" , "when given, only benchmarks with specified categories will run" ) do |v |
44+ opts . on ( "--category=headline,other,micro,ractor,ractor-only " , "when given, only benchmarks with specified categories will run" ) do |v |
4545 args . categories = v . split ( "," )
4646 end
4747
@@ -59,11 +59,18 @@ def free_file_path(parent_dir, name_prefix)
5959 end
6060end
6161
62- def run_benchmark ( bench_name , no_yjit , logs_path , run_time , ruby_version )
62+ def run_benchmark ( bench_id , no_yjit , logs_path , run_time , ruby_version )
6363 # Determine the path to the benchmark script
64- script_path = File . join ( 'benchmarks' , bench_name , 'benchmark.rb' )
64+ bench_name = bench_id . sub ( 'ractor/' , '' )
65+ bench_dir , harness = if bench_name == bench_id
66+ [ 'benchmarks' , 'harness' ]
67+ else
68+ [ 'benchmarks-ractor' , 'harness-ractor' ]
69+ end
70+
71+ script_path = File . join ( bench_dir , bench_name , 'benchmark.rb' )
6572 if not File . exist? ( script_path )
66- script_path = File . join ( 'benchmarks' , bench_name + '.rb' )
73+ script_path = File . join ( bench_dir , bench_name + '.rb' )
6774 end
6875
6976 # Assemble random environment variable options to test
@@ -101,7 +108,7 @@ def run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version)
101108 cmd = [
102109 'ruby' ,
103110 *test_options ,
104- "-Iharness " ,
111+ "-I #{ harness } " ,
105112 script_path ,
106113 ] . compact
107114 cmd_str = cmd . shelljoin
@@ -133,7 +140,7 @@ def run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version)
133140 puts "ERROR"
134141
135142 # Write command executed and output
136- out_path = free_file_path ( logs_path , "error_#{ bench_name } " )
143+ out_path = free_file_path ( logs_path , "error_#{ bench_name . gsub ( '/' , '_' ) } " )
137144 puts "writing output file #{ out_path } "
138145 contents = ruby_version + "\n \n " + "pid #{ status . pid } \n " + user_cmd_str + "\n \n " + output
139146 File . write ( out_path , contents )
@@ -191,11 +198,38 @@ def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version)
191198
192199# Extract the names of benchmarks in the categories we want
193200metadata = YAML . load_file ( 'benchmarks.yml' )
194- metadata = metadata . filter do |bench_name , entry |
195- category = entry . fetch ( 'category' , 'other' )
196- args . categories . include? category
201+ bench_names = [ ]
202+
203+ if args . categories . include? ( 'ractor-only' )
204+ # Only include benchmarks with ractor/ prefix (from benchmarks-ractor directory)
205+ bench_names = metadata . keys . select { |name | name . start_with? ( 'ractor/' ) }
206+ elsif args . categories . include? ( 'ractor' )
207+ # Include both ractor/ prefixed benchmarks and those with ractor: true
208+ metadata . each do |name , entry |
209+ if name . start_with? ( 'ractor/' ) || entry [ 'ractor' ]
210+ bench_names << name
211+ end
212+ end
213+
214+ # Also include regular category benchmarks if other categories are specified
215+ if args . categories . any? { |cat | [ 'headline' , 'other' , 'micro' ] . include? ( cat ) }
216+ metadata . each do |name , entry |
217+ category = entry . fetch ( 'category' , 'other' )
218+ if args . categories . include? ( category ) && !bench_names . include? ( name )
219+ bench_names << name
220+ end
221+ end
222+ end
223+ else
224+ # Regular category filtering
225+ metadata . each do |name , entry |
226+ category = entry . fetch ( 'category' , 'other' )
227+ if args . categories . include? ( category )
228+ bench_names << name
229+ end
230+ end
197231end
198- bench_names = metadata . map { | name , entry | name }
232+
199233bench_names . sort!
200234
201235# Fork the test processes
0 commit comments