diff --git a/harness-ractor/harness.rb b/harness-ractor/harness.rb index cf24076a..eb96291c 100644 --- a/harness-ractor/harness.rb +++ b/harness-ractor/harness.rb @@ -130,6 +130,7 @@ def run_benchmark_gc(warmup_itrs, bench_itrs, block, ractor_args, gc_config:) end gc_by_ractors[rs] = group end + print_gc_legend return_results(warmups.values.flatten, stats.values.flatten, warmup_by_ractors: warmups, bench_by_ractors: stats, **ractor_gc_results(gc_by_ractors, gc_config)) end @@ -138,6 +139,9 @@ def print_gc_header(prefix) header = prefix + " gc_total marking sweeping gc_count major minor global" CONTROLLER_GC_SERIES.each_value { |(_stat_key, label)| header << " %9s" % label } puts header +end + +def print_gc_legend puts "(* controller-observed compacting cycles; may overlap global counts and is not additive.)" if CONTROLLER_GC_SERIES.any? end @@ -277,6 +281,8 @@ def run_scenario_benchmark(bench_itrs, gc_config:, &scenario) gc_by_ractors[count] = group.merge(series) end + print_gc_legend if RACTOR_GC_ENABLED + medians = counts.to_h { |count| [count, memory_summary(memory[count])] } print_memory_metrics(medians) diff --git a/test/ractor_gc_harness_test.rb b/test/ractor_gc_harness_test.rb index 85e6017b..8c76c51d 100644 --- a/test/ractor_gc_harness_test.rb +++ b/test/ractor_gc_harness_test.rb @@ -222,8 +222,12 @@ def run_workload(body, env: {}) assert_equal %w[0 1 2], data['gc_by_ractors'].keys.sort if data['gc_by_ractors'].values.any? { |group| group.key?('gc_controller_compact_count_bench') } - assert_includes stdout, '(* controller-observed compacting cycles; may overlap global counts and is not additive.)', - 'a starred stdout column must always come with the exact legend line' + legend = '(* controller-observed compacting cycles; may overlap global counts and is not additive.)' + lines = stdout.lines(chomp: true) + legend_index = lines.index(legend) + refute_nil legend_index, 'a starred stdout column must always come with the exact legend line' + last_row_index = lines.rindex { |line| line.match?(/\A2\s+#2:/) } + assert_operator legend_index, :>, last_row_index, 'the legend must follow the last table row' end expected_worker_keys = %w[