profiling

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Unlicense Imports: 12 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlameGraphGenerator

type FlameGraphGenerator struct{}

func NewFlameGraphGenerator

func NewFlameGraphGenerator() *FlameGraphGenerator

func (*FlameGraphGenerator) GenerateFlamegraph

func (f *FlameGraphGenerator) GenerateFlamegraph(profileData []byte) ([]byte, error)

type GPURecord

type GPURecord struct {
	Timestamp    time.Time
	KernelName   string
	DurationUs   int64
	MemoryUsedMB int64
	Utilization  float32
}

type GPURecorder

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

func NewGPURecorder

func NewGPURecorder(maxRecords int) *GPURecorder

func (*GPURecorder) GetRecords

func (g *GPURecorder) GetRecords() []GPURecord

func (*GPURecorder) Record

func (g *GPURecorder) Record(kernelName string, durationUs int64, memUsedMB int64, util float32)

type LeakDetectorConfig

type LeakDetectorConfig struct {
	ThresholdMB      int
	CheckInterval    time.Duration
	EnableCPUPprof   bool
	EnableMemPprof   bool
	EnableGoroutine  bool
	EnableBlock      bool
	EnableMutex      bool
	ProfileOutputDir string
}

func DefaultLeakDetectorConfig

func DefaultLeakDetectorConfig() LeakDetectorConfig

type LeakDetectorManager

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

func NewLeakDetectorManager

func NewLeakDetectorManager(logger zerolog.Logger, config LeakDetectorConfig) *LeakDetectorManager

func (*LeakDetectorManager) CaptureProfiles

func (ldm *LeakDetectorManager) CaptureProfiles() error

func (*LeakDetectorManager) GetStats

func (ldm *LeakDetectorManager) GetStats() (heapAlloc, heapObjects uint64, goroutines int)

func (*LeakDetectorManager) Start

func (ldm *LeakDetectorManager) Start()

func (*LeakDetectorManager) Stop

func (ldm *LeakDetectorManager) Stop()

type LeakReport

type LeakReport struct {
	Timestamp      time.Time
	Snapshots      []*MemSnapshot
	GrowthBytes    int64
	GrowthObjects  int64
	GrowthPercent  float64
	TopAllocations []string
	GoroutineDiff  int
}

type MemSnapshot

type MemSnapshot struct {
	Timestamp     time.Time
	HeapAlloc     uint64
	HeapObjects   uint64
	StackInUse    uint64
	MSpanInUse    uint64
	MCacheInUse   uint64
	GCCPUFraction float64
	NumGoroutine  int
}

type MemoryLeakDetector

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

func NewMemoryLeakDetector

func NewMemoryLeakDetector(logger zerolog.Logger, thresholdMB int, interval time.Duration) *MemoryLeakDetector

func (*MemoryLeakDetector) CaptureBaseline

func (mld *MemoryLeakDetector) CaptureBaseline()

func (*MemoryLeakDetector) GetCurrentStats

func (mld *MemoryLeakDetector) GetCurrentStats() (heapAlloc, heapObjects uint64, goroutines int)

func (*MemoryLeakDetector) GetSnapshots

func (mld *MemoryLeakDetector) GetSnapshots() []*MemSnapshot

func (*MemoryLeakDetector) SetAlertCallback

func (mld *MemoryLeakDetector) SetAlertCallback(callback func(*LeakReport))

func (*MemoryLeakDetector) Start

func (mld *MemoryLeakDetector) Start()

func (*MemoryLeakDetector) Stop

func (mld *MemoryLeakDetector) Stop()

func (*MemoryLeakDetector) WriteBlockProfile

func (mld *MemoryLeakDetector) WriteBlockProfile(w io.Writer) error

func (*MemoryLeakDetector) WriteGoroutineProfile

func (mld *MemoryLeakDetector) WriteGoroutineProfile(w io.Writer) error

func (*MemoryLeakDetector) WriteHeapProfile

func (mld *MemoryLeakDetector) WriteHeapProfile(w io.Writer) error

func (*MemoryLeakDetector) WriteMutexProfile

func (mld *MemoryLeakDetector) WriteMutexProfile(w io.Writer) error

func (*MemoryLeakDetector) WriteThreadCreateProfile

func (mld *MemoryLeakDetector) WriteThreadCreateProfile(w io.Writer) error

type Profiler

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

func NewProfiler

func NewProfiler(config ProfilerConfig, logger *zerolog.Logger) *Profiler

func (*Profiler) Start

func (p *Profiler) Start(ctx context.Context) error

func (*Profiler) Stop

func (p *Profiler) Stop() error

func (*Profiler) WriteProfile

func (p *Profiler) WriteProfile(profileType string, w io.Writer) error

type ProfilerConfig

type ProfilerConfig struct {
	ProfileDir      string
	CPUProfile      bool
	MemProfile      bool
	BlockProfile    bool
	MutexProfile    bool
	ProfileInterval time.Duration
}

Jump to

Keyboard shortcuts

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