perfbench

package
v0.0.0-...-4dc15df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

perfbench is a utility for counting performance events in a Go benchmark.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counters

type Counters struct {
	// contains filtered or unexported fields
}

Counters is a set of performance counters that will be reported in benchmark results.

func Open

func Open(b *testing.B) *Counters

Open starts a set of performance counters for benchmark b. These counters will be reported as metrics when the benchmark ends. The counters only count performance events on the calling goroutine.

The counters are running on return. In general, any calls to b.StopTimer, b.StartTimer, or b.ResetTimer should be paired with the equivalent calls on Counters.

The final value of the counters is captured in a b.Cleanup function. If the benchmark does substantial other work in cleanup functions, it may want to explicitly call Counters.Stop before returning.

func (*Counters) Reset

func (cs *Counters) Reset()

func (*Counters) Start

func (cs *Counters) Start()

func (*Counters) Stop

func (cs *Counters) Stop()

func (*Counters) Total

func (cs *Counters) Total(name string) (float64, bool)

Total returns the total count of the named counter, which is a reported metric name without the "/op". If the named counter is unknown or could not be opened, this returns 0, false.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL