Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions harness/harness-common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def return_results(warmup_iterations, bench_iterations)
end

write_json_file(yjit_bench_results)

if ENV["YJIT_BENCH_SHOW_DEBUG_COUNTERS"]=="1"
ENV["RUBY_DEBUG_COUNTER_DISABLE"] = "0"
RubyVM.show_debug_counters if defined?(RubyVM.show_debug_counters)
ENV["RUBY_DEBUG_COUNTER_DISABLE"] = "1"
end
end

def write_json_file(yjit_bench_results)
Expand Down
1 change: 1 addition & 0 deletions harness/harness.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def run_benchmark(_num_itrs_hint, &block)
header = "itr: time"

RubyVM::YJIT.reset_stats! if defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
RubyVM.reset_debug_counters if defined?(RubyVM.reset_debug_counters)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are you fine with this not being used by the vernier harness? I think that's what confused me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you edited this file, I assume you tested this feature on this default harness. Given there's some overhead in using debug counters, I wonder if you really want to do both debug counters and vernier at the same time. The vernier profiling result could be off due to the overhead of debug counters, so you might want to do them separately anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay I understand your concerns. I think you're right, maybe I'll just create a new harness. I'll update the PR later this week 👍


# If $YJIT_BENCH_STATS is given, print the diff of these stats at each iteration.
if ENV["YJIT_BENCH_STATS"]
Expand Down
6 changes: 6 additions & 0 deletions run_benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,12 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
opts.on("--turbo", "don't disable CPU turbo boost") do
args.turbo = true
end

opts.on("--show-debug-counters", "Show debug counters (if available) after each benchmark has run") do
# disable showing debug counters for any subprocesses of ruby that we run except the benchmark scripts themselves
ENV["RUBY_DEBUG_COUNTER_DISABLE"] = "1"
ENV["YJIT_BENCH_SHOW_DEBUG_COUNTERS"] = "1"
end
end.parse!

# Remaining arguments are treated as benchmark name filters
Expand Down