基准测试指标格式(BMF)
内置的基准测试适配器会将基准测试的输出转换为 Bencher Metric Format (BMF) JSON 格式。
自定义基准测试工具应输出其结果为 BMF JSON 格式,
并使用json
适配器。
查看如何跟踪自定义基准测试以获得完整概述。
示例 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 } }}
在这个示例中,有三个基准测试:
benchmark_name
基准测试,包含两个测量:- 延迟 (
latency
) - 吞吐量 (
throughput
)
- 延迟 (
/bin/sh -c ./my_build_script.sh
基准测试,包含一个测量用于跟踪构建时间 (build-time
)my_binary
基准测试,包含一个测量用于跟踪文件大小 (file-size
)
Bencher 指标格式 (BMF) JSON 架构
这是 Bencher 指标格式 (BMF) JSON 的 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"] } } } }}