Closed
Description
Package testing has built-in support for three statistics: wall time, allocations, and memory allocated. There is discussion of adding more: #24918.
I propose that we also expose to users the ability to report their own benchmark-specific statistics. An example comes from package sort (proximally via #26031): The number of calls to Swap and Less.
Proposed API:
func (b *B) ReportStats(n int, units string)
This will cause benchmark invocations to include <n/b.N> <units>/op
in the benchmark output. Then the sort of output reported in #26031 could be used as input to benchstat.