Skip to content

Conversation

luke-gruber
Copy link
Collaborator

If we compile ruby with debug counters and use that ruby for running yjit-bench, there's a mess of output due to the ruby subprocesses that get run (ex: bundle install). This is because by default, the output is shown at ruby exit. This change adds a new option --show-debug-counters that disables all debug counter output for everything except the benchmark scripts. The counters get reset before each benchmark script is run so that the counters during ruby initialization and prelude are not taken into account.

@k0kubun
Copy link
Member

k0kubun commented Jul 7, 2025

How about implementing that as a new harness? Do you need to use this on multiple different harnesses? If you create harness-debug-counters/harness.rb, you can use it with --harness debug-counters.

@luke-gruber
Copy link
Collaborator Author

I can make a harness if you prefer, but I was hoping to use this alongside the vernier harness.

@luke-gruber luke-gruber force-pushed the integrate_ruby_debug_counters branch from 5809f79 to dd710c2 Compare July 8, 2025 15:05
If we compile ruby with debug counters and use that ruby for running yjit-bench,
there's a mess of output due to the ruby subprocesses that get run (ex: `bundle install`).
This is because by default, the output is shown at ruby exit. This change adds a new option
`--show-debug-counters` that disables all debug counter output for everything except the
benchmark scripts. The counters get reset before each benchmark script is run so that the
counters during ruby initialization and prelude are not taken into account.
@luke-gruber luke-gruber force-pushed the integrate_ruby_debug_counters branch from dd710c2 to 338466a Compare July 8, 2025 15:25
@k0kubun
Copy link
Member

k0kubun commented Jul 8, 2025

Oh ok, it seems fair to implement that on the harness-common then.

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 👍

@luke-gruber
Copy link
Collaborator Author

I'm no longer interested in using debug counters for benchmarking, so I'm closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants