Documentation
¶
Index ¶
Constants ¶
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.
This function now tracks both total time (wall-clock) and self-time (excluding children). For recursive functions, each call is counted separately, but timing remains accurate. Example: ProcessYAML called 1,890 times recursively will show count=1,890 but accurate timing.
Note: `atmosConfig` parameter is reserved for future use.
Types ¶
type CallStack ¶ added in v1.194.1
type CallStack struct {
// contains filtered or unexported fields
}
CallStack tracks nested function calls for a single goroutine.
type Metric ¶
type Metric struct {
Name string
Count int64
Total time.Duration // Wall-clock time (includes children).
SelfTime time.Duration // Actual work time (excludes children).
Max time.Duration // Max self-time (excludes children).
Hist *hdrhistogram.Histogram // Histogram for self-time percentiles (optional, nil if disabled).
}
Metric tracks performance data for a function. Total includes time spent in child function calls (wall-clock time). SelfTime excludes time spent in child calls (actual work done in the function).
type Row ¶
type Row struct {
Name string
Count int64
Total time.Duration // Wall-clock time (includes children).
SelfTime time.Duration // Actual work time (excludes children).
Avg time.Duration // Average self-time per call.
Max time.Duration // Max self-time (excludes children).
P95 time.Duration // 95th percentile of self-time (0 if HDR disabled).
}
Row represents a single function's performance metrics in the output.
type Snapshot ¶
func SnapshotTop ¶
func SnapshotTopFiltered ¶
SnapshotTopFiltered returns the top N functions sorted by the given field, filtering out functions with zero total time.
type StackFrame ¶ added in v1.194.1
type StackFrame struct {
// contains filtered or unexported fields
}
StackFrame represents a single frame in the call stack for tracking nested calls.