I've seen there is a struct testing.BenchmarkResult
in Go to accesss the result of a benchmark but I found very little documentation or examples to help me use it.
So far I have only been benchmarking my functions like this:
func BenchmarkMyFunction(b *testing.B) {
// call to myFunction
}
And then running:
go test -bench=".*"
Here the results are printed to the console but I'd like to store them in a separate file. How can I use the BenchmarkResult
type to do this?