perf

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(name string, delta int64)

Count increments a named counter by delta.

func EnableForTest added in v0.0.12

func EnableForTest() func()

EnableForTest forces perf collection on (and disables periodic logging). It returns a restore function to reset prior settings.

func Enabled

func Enabled() bool

Enabled reports whether profiling is enabled.

func Flush added in v0.0.12

func Flush(reason string)

Flush logs a summary of current stats/counters immediately. If reason is provided, it is included in the log prefix.

func Record

func Record(name string, d time.Duration)

Record captures a duration sample for the given name.

func Snapshot added in v0.0.12

func Snapshot() ([]StatSnapshot, []CounterSnapshot)

Snapshot returns current perf stats/counters and resets them.

func Time

func Time(name string) func()

Time returns a function that records elapsed time when invoked.

Types

type CounterSnapshot added in v0.0.12

type CounterSnapshot struct {
	Name  string
	Value int64
}

CounterSnapshot captures perf counters for diagnostics/tests.

type StatSnapshot added in v0.0.12

type StatSnapshot struct {
	Name  string
	Count int64
	Avg   time.Duration
	Min   time.Duration
	Max   time.Duration
	P95   time.Duration
}

StatSnapshot captures perf duration stats for diagnostics/tests.

Jump to

Keyboard shortcuts

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