trace

package
v0.0.85 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 6 Imported by: 0

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