Gungraun

Gungraun is divided into the library gungraun and the benchmark runner gungraun-runner.

Installation of the library

To start with Gungraun, add the following to your Cargo.toml file:

[dev-dependencies]
gungraun = "0.17.0"

or run

cargo add --dev gungraun@0.17.0

Installation of the benchmark runner

To be able to run the benchmarks you'll also need the gungraun-runner binary installed somewhere in your $PATH. Otherwise, there is no need to interact with gungraun-runner as it is just an implementation detail.

From Source

cargo install --version 0.17.0 gungraun-runner

There's also the possibility to install the binary somewhere else and point the GUNGRAUN_RUNNER environment variable to the absolute path of the gungraun-runner binary like so:

cargo install --version 0.17.0 --root /tmp gungraun-runner
GUNGRAUN_RUNNER=/tmp/bin/gungraun-runner cargo bench --bench my-bench

Binstall

The gungraun-runner binary is pre-built for most platforms supported by valgrind and easily installable with binstall

cargo binstall gungraun-runner@0.17.0

Updating

When updating the gungraun library, you'll also need to update gungraun-runner and vice-versa or else the benchmark runner will exit with an error.

In the Github CI

Since the gungraun-runner version must match the gungraun library version it's best to automate this step in the CI. A job step in the github actions CI could look like this

- name: Install gungraun-runner
  run: |
    version=$(cargo metadata --format-version=1 |\
      jq '.packages[] | select(.name == "gungraun").version' |\
      tr -d '"'
    )
    cargo install gungraun-runner --version $version

Or, speed up the overall installation time with binstall using the taiki-e/install-action

- uses: taiki-e/install-action@cargo-binstall
- name: Install gungraun-runner
  run: |
    version=$(cargo metadata --format-version=1 |\
      jq '.packages[] | select(.name == "gungraun").version' |\
      tr -d '"'
    )
    cargo binstall --no-confirm gungraun-runner --version $version