Background
Currently go test -bench . prints out benchmark results in a certain format, but there is no guarantee that this format will not change. Thus a tool that parses go test output may break if an incompatible change to the output format is made.
Also currently there is no good way to distinguish benchmark results from the rest of go test output, other than checking that a line starts with "Benchmark".
Proposal
- Add
-benchformat flag to go test. Its value is a text/template template with BenchmarkResult input, similar to -f flag in go list.
- Add
Proc to BenchmarkResult. It will have the value of runtime.GOMAXPROCS at the beginning of B.launch call.
Example:
$ go test -run=^$ -bench . \
-benchformat "BENCHMARK STARTS HERE:{{.Name}}:{{.Proc}}:{{.T}}:{{.N}}:{{.Bytes}}"
PASS
BENCHMARK STARTS HERE:BenchmarkFoo:8:1s:10000:0
BENCHMARK STARTS HERE:BenchmarkBar:8:1s:10000:0
Background
Currently
go test -bench .prints out benchmark results in a certain format, but there is no guarantee that this format will not change. Thus a tool that parses go test output may break if an incompatible change to the output format is made.Also currently there is no good way to distinguish benchmark results from the rest of
go testoutput, other than checking that a line starts with"Benchmark".Proposal
-benchformatflag togo test. Its value is a text/template template withBenchmarkResultinput, similar to-fflag ingo list.ProctoBenchmarkResult. It will have the value ofruntime.GOMAXPROCSat the beginning ofB.launchcall.Example: