Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose HYPERFINE_ITERATION to intermediate commands #807

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

willcl-ark
Copy link

Fixes: #781

Expose the $HYPERFINE_ITERATION variable to intermediate commands. This will allow iteration-specific prepare/conclude, such as:

hyperfine --runs 5 --prepare 'echo touch file${HYPERFINE_ITERATION}.dat' \
    'echo testing file${HYPERFINE_ITERATION}.dat' \
    --conclude 'echo rm file${HYPERFINE_ITERATION}.dat' --show-output

@willcl-ark willcl-ark force-pushed the expose-run-var branch 2 times, most recently from bd3ce78 to e0f1fdb Compare March 13, 2025 09:41
Fixes: sharkdp#781

Expose the `$HYPERFINE_ITERATION` variable to intermediate commands.
This will allow iteration-specific prepare/conclude, such as:

```bash
hyperfine --runs 5 --prepare 'echo touch file${HYPERFINE_ITERATION}.dat' \
    'echo testing file${HYPERFINE_ITERATION}.dat' \
    --conclude 'echo rm file${HYPERFINE_ITERATION}.dat' --show-output
```
@willcl-ark
Copy link
Author

I don't have a Windows machine (or much experience on that platform) to tidy up the added integration test, so have resorted to stripping the lines.

If there is a cleaner way to echo a value to a file on windows without it adding extra whitespace, then please let me know and I can switch out for that.

willcl-ark added a commit to bitcoin-dev-tools/benchkit that referenced this pull request Mar 13, 2025
Introduce a mandatory `--output-dir` option when running benchmarks.
This will, in the future, be used to store benchmark configuration,
results and run artifacts.

Currently it will store configuration and the final run artifact, as the
changes needed in hyperfine to expose the run iteration are not
available yet. (see: sharkdp/hyperfine#807 )
@l0rinc
Copy link

l0rinc commented Mar 15, 2025

nice!

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.

${HYPERFINE_ITERATION} is not visible in prepare or conclude commands
2 participants