Bencher Metric Format (BMF)
Built-in benchmark harness adapters convert benchmark output into Bencher Metric Format (BMF) JSON.
Custom benchmarking harnesses should output their results as BMF JSON
and use the json adapter.
See how to track custom benchmarks for a full overview.
To generate mock BMF JSON data, use the bencher mock CLI subcommand.
Example Bencher Metric Format (BMF) JSON
{ "benchmark_name": { "latency": { "value": 88.0, "lower_value": 87.42, "upper_value": 88.88 }, "throughput": { "value": 5.55, "lower_value": 3.14, "upper_value": 6.30 } }, "/bin/sh -c ./my_build_script.sh": { "build-time": { "value": 87.0 } }, "my_binary": { "file-size": { "value": 42.0 } }}In this example, there are three Benchmarks:
benchmark_nameBenchmark with two Measures:- Latency (
latency) - Throughput (
throughput)
- Latency (
/bin/sh -c ./my_build_script.shBenchmark with one Measure to track build time (build-time)my_binaryBenchmark with one Measure to track file size (file-size)
Order of Precedence
The order of precedence for identifying a Benchmark is as follows:
UUID- Kebab case
namewith a-bencher-ignoresuffix that is stripped to suppress alerts (max length1024characters) slug(max length64characters)name(max length1024characters)
The order of precedence for identifying a Measure is as follows:
UUIDslug(max length64characters)name(max length64characters)
Bencher Metric Format (BMF) JSON Schema
This is the JSON schema for Bencher Metric Format (BMF) JSON:
{ "$id": "https://bencher.dev/bmf.json", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "patternProperties": { ".+": { "type": "object", "patternProperties": { ".+": { "type": "object", "properties": { "value": { "type": "number" }, "lower_value": { "type": "number" }, "upper_value": { "type": "number" } }, "required": ["value"] } } } }}Schema Versions:
- Latest:
https://bencher.dev/bmf.json v0(latest):https://bencher.dev/v0/bmf.json
bencher mock
The bencher mock CLI subcommand is used to generate mock Bencher Metric Format (BMF) JSON data.
--seed <SEED>
The seed for the pseudorandom number generator. If not specified, a random seed will be used.
--count <COUNT>
The number of mock Benchmarks to generate.
--measure <MEASURE>
The Measure to use for each Benchmark.
Multiple Measures can be specified by using the --measure option multiple times.
The default is the built-in latency Measure.
--pow <POW>
The power of 10 to use for the mock Metrics.
The default is 1.
--fail
Fail while running.
--flaky
Intermittently fail while running.
--help
Print the help message.