Documentation ¶
Overview ¶
Package driver provides common benchmarking logic shared between benchmarks.
A benchmark should call Main with a benchmark function. The benchmark function can do one of two things when invoked:
- Do whatever it wants, fill and return Result object.
- Call Benchmark helper function and provide benchmarking function func(N uint64), similar to standard testing benchmarks. The rest is handled by the driver.
Index ¶
- Variables
- func BenchMem() int
- func InitSysStats(N uint64) sysStats
- func LatencyNote(t time.Time)
- func Main(name string, f func() Result)
- func Parallel(N uint64, P int, f func())
- func RunAndCollectSysStats(cmd *exec.Cmd, res *Result, N uint64, prefix string) (string, error)
- func RunUnderProfiler(args ...string) (string, string)
- func Size(file string) string
- type Result
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BenchTime time.Duration WorkDir string )
Functions ¶
func InitSysStats ¶
func InitSysStats(N uint64) sysStats
func LatencyNote ¶
func Parallel ¶
Parallel is a public helper function that runs f N times in P*GOMAXPROCS goroutines.
func RunAndCollectSysStats ¶
func RunUnderProfiler ¶
Runs the cmd under perf. Returns filename of the profile. Any errors are ignored.
Types ¶
type Result ¶
type Result struct { N uint64 // number of iterations Duration time.Duration // total run duration RunTime uint64 // ns/op Metrics map[string]uint64 Files map[string]string }
Result contains all the interesting data about benchmark execution.
func MakeResult ¶
func MakeResult() Result
Click to show internal directories.
Click to hide internal directories.