Documentation
¶
Overview ¶
Package profiling provides runtime profiling and performance monitoring
Index ¶
- type CPUProfile
- type Config
- type GCStats
- type GoroutineStats
- type Manager
- func (m *Manager) GenerateReport() (*Report, error)
- func (m *Manager) GetAllStats() map[string]interface{}
- func (m *Manager) GetCPUProfile() *CPUProfile
- func (m *Manager) GetGCStats() *GCStats
- func (m *Manager) GetGoroutineStats() *GoroutineStats
- func (m *Manager) GetMemProfile() *MemProfile
- func (m *Manager) Start() error
- func (m *Manager) StartCPUProfile(duration time.Duration) (string, error)
- func (m *Manager) StartTrace(duration time.Duration) (string, error)
- func (m *Manager) Stop() error
- func (m *Manager) StopCPUProfile() error
- func (m *Manager) StopTrace() error
- func (m *Manager) WriteGoroutineProfile() (string, error)
- func (m *Manager) WriteHeapProfile() (string, error)
- type MemProfile
- type Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUProfile ¶
CPUProfile tracks CPU usage statistics
type Config ¶
type Config struct {
Enabled bool
DataDir string
CPUProfile bool
MemProfile bool
GoroutineDump bool
Trace bool
Interval time.Duration
}
Config for profiling manager
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns default profiling configuration
type GCStats ¶
type GCStats struct {
NumGC uint32
PauseTotal time.Duration
PauseAvg time.Duration
PauseMax time.Duration
PauseHist []time.Duration
Timestamp time.Time
}
GCStats tracks garbage collection statistics
type GoroutineStats ¶
type GoroutineStats struct {
Count int
MaxCount int
AvgCount int
History []int
Timestamp time.Time
}
GoroutineStats tracks goroutine information
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles profiling operations
func NewManager ¶
NewManager creates a new profiling manager
func (*Manager) GenerateReport ¶
GenerateReport creates a performance report
func (*Manager) GetAllStats ¶
GetAllStats returns all current statistics
func (*Manager) GetCPUProfile ¶
func (m *Manager) GetCPUProfile() *CPUProfile
GetCPUProfile returns current CPU profile
func (*Manager) GetGCStats ¶
GetGCStats returns GC statistics
func (*Manager) GetGoroutineStats ¶
func (m *Manager) GetGoroutineStats() *GoroutineStats
GetGoroutineStats returns goroutine statistics
func (*Manager) GetMemProfile ¶
func (m *Manager) GetMemProfile() *MemProfile
GetMemProfile returns current memory profile
func (*Manager) StartCPUProfile ¶
StartCPUProfile starts CPU profiling
func (*Manager) StartTrace ¶
StartTrace starts execution tracing
func (*Manager) StopCPUProfile ¶
StopCPUProfile stops CPU profiling
func (*Manager) WriteGoroutineProfile ¶
WriteGoroutineProfile writes goroutine profile to file
func (*Manager) WriteHeapProfile ¶
WriteHeapProfile writes current heap profile to file
type MemProfile ¶
type MemProfile struct {
Alloc uint64
TotalAlloc uint64
Sys uint64
NumGC uint32
HeapAlloc uint64
HeapSys uint64
HeapIdle uint64
HeapInuse uint64
HeapReleased uint64
StackInuse uint64
StackSys uint64
Timestamp time.Time
}
MemProfile tracks memory statistics
type Report ¶
type Report struct {
Timestamp time.Time
MemStats MemProfile
CPUStats CPUProfile
Goroutines GoroutineStats
GCStats GCStats
}
Report contains performance data
func (*Report) WriteToFile ¶
WriteToFile saves report to JSON file