import "v.io/x/ref/test/benchmark"
Package benchmark implements utilities to augment the standard Go testing.Benchmark functionality.
RunTestMain runs the tests with enabling injection of benchmark stats. It returns an exit code to pass to os.Exit.
type Stats struct {
// contains filtered or unexported fields
}
Stats is a simple helper for gathering additional statistics like histogram during benchmarks. This is not thread safe.
AddStats adds a new unnamed Stats instance to the current benchmark. You need to run benchmarks by calling RunTestMain() to inject the stats to the benchmark results. If numBuckets is not positive, the default value (16) will be used. Please note that this calls b.ResetTimer() since it may be blocked until the previous benchmark stats is printed out. So AddStats() should typically be called at the very beginning of each benchmark function.
AddStatsWithName adds a new named Stats instance to the current benchmark. With this, you can add multiple stats in a single benchmark. You need to run benchmarks by calling RunTestMain() to inject the stats to the benchmark results. If numBuckets is not positive, the default value (16) will be used. Please note that this calls b.ResetTimer() since it may be blocked until the previous benchmark stats is printed out. So AddStatsWithName() should typically be called at the very beginning of each benchmark function.
NewStats creates a new Stats instance. If numBuckets is not positive, the default value (16) will be used.
Add adds an elapsed time per operation to the stats.
Clear resets the stats, removing all values.
Print writes textual output of the Stats.
String returns the textual output of the Stats as string.
Package benchmark imports 13 packages (graph) and is imported by 10 packages. Updated 2020-06-09. Refresh now. Tools for package owners.