Documentation ¶
Overview ¶
Package ptesting provides a platform identifier for Go benchmarks.
Index ¶
Constants ¶
View Source
const ( OperationsPerSecond = "op/s" NanosecondsPerOp = "ns/op" SecondsPerOp = "sec/op" )
Variables ¶
This section is empty.
Functions ¶
func Versions ¶ added in v0.4.66
func Versions() (keyValueLines string)
Versions returns printable key-value pairs for the Benchmark environment:
macOS:
goversion: go1.20.1 osversion: macOS 13.2.1 cpu: Apple M1 Max
Linux:
goversion: go1.20.1 osversion: Linux 5.19.0-32-generic cpu: Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Usage:
func BenchmarkXxx(b *testing.B) { println(ptesting.Versions) …
Types ¶
type SubBenchLogger ¶
type SubBenchLogger struct { LastSubBench *SubBench T0 time.Time // contains filtered or unexported fields }
func NewSubBenchLogger ¶
func NewSubBenchLogger(b *testing.B) (sbl *SubBenchLogger)
NewSubBenchLogger returns an object to measure latency of each sub-benchmark b.N invocation
Usage:
func BenchmarkXxx(b *testing.B) { benchLogger := NewSubBenchLogger(b) defer benchLogger.Log() b.Run(…, func(b *testing.B) { defer benchLogger.Invo(b)
func (*SubBenchLogger) Invo ¶
func (s *SubBenchLogger) Invo(b *testing.B)
func (*SubBenchLogger) Log ¶
func (s *SubBenchLogger) Log()
type SubBenchRun ¶
Click to show internal directories.
Click to hide internal directories.