perf

package
v1.194.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMatrixCapacity = 64
)

Variables

This section is empty.

Functions

func EnableTracking

func EnableTracking(enabled bool)

EnableTracking enables performance tracking globally. HDR histogram for P95 latency is automatically enabled when tracking is enabled.

func Track

func Track(atmosConfig *schema.AtmosConfiguration, name string) func()

Track returns a func you should defer to record duration for a Go function. Performance tracking is enabled via the `--heatmap` flag. Use `--heatmap` flag to display the collected metrics. Note: `atmosConfig` parameter is reserved for future use.

Types

type Metric

type Metric struct {
	Name  string
	Count int64
	Total time.Duration
	Max   time.Duration
	Hist  *hdrhistogram.Histogram // optional (nil if disabled)
}

type Row

type Row struct {
	Name  string
	Count int64
	Total time.Duration
	Avg   time.Duration
	Max   time.Duration
	P95   time.Duration // 0 if HDR disabled
}

type Snapshot

type Snapshot struct {
	Rows       []Row
	Elapsed    time.Duration
	TotalFuncs int
	TotalCalls int64
}

func SnapshotTop

func SnapshotTop(by string, topN int) Snapshot

func SnapshotTopFiltered

func SnapshotTopFiltered(by string, topN int) Snapshot

SnapshotTopFiltered returns the top N functions sorted by the given field, filtering out functions with zero total time.

Jump to

Keyboard shortcuts

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