Skip to content

Add callgrind harness - #576

Merged
tekknolagi merged 4 commits into
mainfrom
mb-callgrind-harness
Nov 12, 2026
Merged

tekknolagi merged 4 commits into
mainfrom
mb-callgrind-harness

Conversation

@tekknolagi

@tekknolagi tekknolagi commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

I want to measure callgrind instructions too, which can be more stable than pure wall time.

Comment thread lib/benchmark_suite.rb

# Set up the benchmarking command
cmd = (cmd_prefix + [
profiler_prefix = benchmark_harness == "callgrind" ? callgrind_cmd(script_path) : []

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this common enough that we should have a harness_cmd_for similar to harness_args_for?

@tekknolagi
tekknolagi marked this pull request as ready for review November 9, 2026 20:25
@tekknolagi
tekknolagi requested a review from a team November 9, 2026 20:25
Comment thread harness/callgrind.rb

# Load before benchmark Bundler setup can hide globally installed gems.
ensure_global_gem("valgrind")
require "valgrind"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is my gem. it seems we don't do gemfiles for this kind of harness dep :/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The gem seems fine to me. It's cleaner than shelling out, which we could always fall back to if necessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe try what the stackprof harness does?

ensure_global_gem("stackprof")

As long as you have gem installed a gem you want to use, there's always a way to load it. And it seems like this repository already has an eastablished hack for that purpose.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah i have ensure_global_gem

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oops sorry, nvm

@XrXr

XrXr commented Nov 9, 2026

Copy link
Copy Markdown
Member

Does it raise an error properly if you run with the harness but without callgrind?

@tekknolagi

Copy link
Copy Markdown
Contributor Author

Now it does, and also detects non-Linux platforms. Thanks

@tekknolagi
tekknolagi merged commit 0e67be0 into main Nov 12, 2026
15 checks passed
@tekknolagi
tekknolagi deleted the mb-callgrind-harness branch November 12, 2026 22:12
@tekknolagi

Copy link
Copy Markdown
Contributor Author

Now to figure out ruby/ruby#19851

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.

4 participants