trace

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultMemorySnapshotInterval is the default interval for taking memory snapshots
	DefaultMemorySnapshotInterval = 100 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionStrategy

type ActionStrategy interface {
	Before()
	After()
	GetMetrics() *Metrics
}

type DefaultStrategy

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

func (*DefaultStrategy) After

func (d *DefaultStrategy) After()

func (*DefaultStrategy) Before

func (d *DefaultStrategy) Before()

func (*DefaultStrategy) GetMetrics

func (d *DefaultStrategy) GetMetrics() *Metrics

type FunctionContext

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

func (*FunctionContext) Execute

func (f *FunctionContext) Execute()

type MemorySnapshot

type MemorySnapshot struct {
	Time  time.Time
	Alloc uint64
}

type Metrics

type Metrics struct {
	StartTime         time.Time
	FinishTime        time.Time
	ExecutionDuration time.Duration
	Snapshots         []MemorySnapshot
	MinAllocMemory    uint64
	MaxAllocMemory    uint64
	AvgAllocMemory    uint64
}

func Trace

func Trace(f func(), setters ...TraceOptionSetter) (*Metrics, error)

type TraceOptionSetter

type TraceOptionSetter func(opts *TraceOptions)

func WithAfter

func WithAfter(a func()) TraceOptionSetter

func WithBefore

func WithBefore(b func()) TraceOptionSetter

func WithStrategy

func WithStrategy(s ActionStrategy) TraceOptionSetter

type TraceOptions

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

Jump to

Keyboard shortcuts

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