From ca49a4de0309bc42c6fe153e019e8d2f90add221 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sun, 11 Oct 2026 07:21:07 +0900 Subject: [PATCH 1/2] Look up the page size only when /proc/self/statm exists Etc::SC_PAGESIZE is not defined on Windows, so every harness-ractor benchmark failed with a NameError at load time. The page size is used only to read /proc/self/statm. Co-Authored-By: Claude Opus 5.5 --- harness-ractor/harness.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/harness-ractor/harness.rb b/harness-ractor/harness.rb index cf24076a..a5d2d4b2 100644 --- a/harness-ractor/harness.rb +++ b/harness-ractor/harness.rb @@ -36,7 +36,6 @@ def join SETTLE_SLEEP = Float(ENV.fetch("RACTOR_MEM_SETTLE_SLEEP", 0.1)) PEAK_SAMPLE_INTERVAL = Float(ENV.fetch("RACTOR_MEM_PEAK_SAMPLE_INTERVAL", 0.005)) GLOBAL_GC_START = GC.method(:start).parameters.include?([:key, :global]) -PAGE_SIZE = Etc.sysconf(Etc::SC_PAGESIZE) def run_benchmark(num_itrs_hint, ractor_args: [], scenario: false, &block) warmup_itrs = Integer(ENV.fetch('WARMUP_ITRS', 5)) @@ -375,6 +374,7 @@ def gc_settle STATM_FILE = "/proc/self/statm" STATM_AVAILABLE = File.exist?(STATM_FILE) +PAGE_SIZE = Etc.sysconf(Etc::SC_PAGESIZE) if STATM_AVAILABLE # The resident set size right now. /proc/self/statm is the cheapest source, which # matters because the peak sampler reads it every PEAK_SAMPLE_INTERVAL. Off Linux From e929b590ca1d27f3a78a0ecb429801e412c99f36 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sun, 11 Oct 2026 13:40:47 +0900 Subject: [PATCH 2/2] Record the Ractor harness test calls in one file per Ractor Two Ractors appending to the same file lose lines on Windows, where Ruby emulates O_APPEND by looking up the end of the file before each write. Co-Authored-By: Claude Opus 5.5 --- test/ractor_harness_test.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/ractor_harness_test.rb b/test/ractor_harness_test.rb index e68bc7de..cab55a44 100644 --- a/test/ractor_harness_test.rb +++ b/test/ractor_harness_test.rb @@ -9,12 +9,13 @@ root = File.expand_path('..', __dir__) Dir.mktmpdir do |dir| result_path = File.join(dir, 'results.json') - calls_path = File.join(dir, 'calls.txt') + calls_dir = File.join(dir, 'calls') + Dir.mkdir(calls_dir) script = File.join(dir, 'workload.rb') File.write(script, <<~RUBY) require #{File.join(root, 'harness', 'loader').inspect} run_benchmark(1) do |count| - File.open(#{calls_path.inspect}, 'a') { |f| f.puts(count) } + File.open(File.join(#{calls_dir.inspect}, Ractor.current.object_id.to_s), 'a') { |f| f.puts(count) } end RUBY env = { @@ -34,7 +35,8 @@ assert_equal({ '2' => 2 }, data['warmup_by_ractors'].transform_values(&:size)) assert_equal({ '2' => 1 }, data['bench_by_ractors'].transform_values(&:size)) assert_equal data['warmup_by_ractors']['2'], data['warmup'] - assert_equal ['2'] * 6, File.readlines(calls_path, chomp: true), '(2 warmup + 1 measured) iterations x 2 Ractors' + calls = Dir.children(calls_dir).flat_map { |f| File.readlines(File.join(calls_dir, f), chomp: true) } + assert_equal ['2'] * 6, calls, '(2 warmup + 1 measured) iterations x 2 Ractors' end end end