Module harness

Module harness 

Source
Expand description

The harness benchmarking configs

This should be placed in the [package.metadata.harness] section of the Cargo.toml file.

If the harness section is not present, a default config will be created, which contains a default profile, with two builds: HEAD pointing to the current commit, and HEAD~1 pointing to the previous commit.

§Example:

The following example defines a default profile.

Note that the default profile will be used by the runner by default, if no profile name is specified when running cargo harness run.

[package.metadata.harness.profiles.default]
iterations = 3 # Optional. Default to 5
invocations = 40 # Optional. Default to 10
# Additional environment variables to set for all builds and benchmarks
# Optional. Default to no additional environment variables
env = { BAR = "BAZ" }

# The list of builds to evaluate.
# If not specified, two builds `HEAD` and `HEAD~1` will be evaluated by default.
[package.metadata.harness.profiles.default.builds]
# No extra build configurations.
# Default cargo features and the current git commit will be used to produce the build.
# No extra environment variables will be set.
foo = {}
# Another build with extra cargo features, and disabled default features
bar = { features = ["unstable"], default-features = false }
# Extra environment variables only for this build.
baz = { env = { "FOO" = "BAR" } }
# Compile this build with a specific git commit.
qux = { commit = "a1b2c3d4e5f6" }

Structs§

BuildConfig
The build configuration used for evaluation
HarnessConfig
The harness configuration.
Profile
The benchmarking profile.