Last active
February 5, 2021 09:08
-
-
Save percybolmer/3bddad07fca4f2c9d8073fcd70f0aaf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// B is a type passed to Benchmark functions to manage benchmark | |
// timing and to specify the number of iterations to run. | |
// | |
// A benchmark ends when its Benchmark function returns or calls any of the methods | |
// FailNow, Fatal, Fatalf, SkipNow, Skip, or Skipf. Those methods must be called | |
// only from the goroutine running the Benchmark function. | |
// The other reporting methods, such as the variations of Log and Error, | |
// may be called simultaneously from multiple goroutines. | |
// | |
// Like in tests, benchmark logs are accumulated during execution | |
// and dumped to standard output when done. Unlike in tests, benchmark logs | |
// are always printed, so as not to hide output whose existence may be | |
// affecting benchmark results. | |
type B struct { | |
common | |
importPath string // import path of the package containing the benchmark | |
context *benchContext | |
N int | |
previousN int // number of iterations in the previous run | |
previousDuration time.Duration // total duration of the previous run | |
benchFunc func(b *B) | |
benchTime benchTimeFlag | |
bytes int64 | |
missingBytes bool // one of the subbenchmarks does not have bytes set. | |
timerOn bool | |
showAllocResult bool | |
result BenchmarkResult | |
parallelism int // RunParallel creates parallelism*GOMAXPROCS goroutines | |
// The initial states of memStats.Mallocs and memStats.TotalAlloc. | |
startAllocs uint64 | |
startBytes uint64 | |
// The net total of this test after being run. | |
netAllocs uint64 | |
netBytes uint64 | |
// Extra metrics collected by ReportMetric. | |
extra map[string]float64 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment