Documentation
¶
Index ¶
- type EBPFManager
- type KernelMonitor
- type ProfileSnapshot
- type Profiler
- func (p *Profiler) CaptureBlockProfile(ctx context.Context, duration time.Duration) ([]byte, error)
- func (p *Profiler) CaptureCPUProfile(ctx context.Context, duration time.Duration) ([]byte, error)
- func (p *Profiler) CaptureGoroutineProfile() ([]byte, error)
- func (p *Profiler) CaptureHeapProfile() ([]byte, error)
- func (p *Profiler) CaptureMutexProfile(ctx context.Context, duration time.Duration) ([]byte, error)
- func (p *Profiler) CaptureThreadCreateProfile() ([]byte, error)
- func (p *Profiler) CaptureTrace(ctx context.Context, duration time.Duration) ([]byte, error)
- func (p *Profiler) EnsureRunning() error
- func (p *Profiler) GetRecentSnapshots(duration time.Duration) []ProfileSnapshot
- func (p *Profiler) StartContinuous()
- func (p *Profiler) StopContinuous()
- type SystemStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EBPFManager ¶
type EBPFManager struct {
Config config.EBPFConfig
}
EBPFManager manages loading and attaching of eBPF programs
func NewEBPFManager ¶
func NewEBPFManager(cfg config.EBPFConfig) *EBPFManager
func (*EBPFManager) LoadAndAttach ¶
func (m *EBPFManager) LoadAndAttach(ctx context.Context) error
LoadAndAttach attempts to load the embedded eBPF programs Note: In a real scenario, this would use 'cilium/ebpf' to load the ELF file. Since we cannot compile C code here, this serves as the architectural implementation.
type KernelMonitor ¶
type KernelMonitor struct {
Enabled bool
}
KernelMonitor simulates eBPF-like observability by reading procfs
func NewKernelMonitor ¶
func NewKernelMonitor() *KernelMonitor
func (*KernelMonitor) CaptureStats ¶
func (k *KernelMonitor) CaptureStats() (*SystemStats, error)
CaptureStats reads /proc/stat and /proc/net/snmp
func (*KernelMonitor) FormatStats ¶
func (k *KernelMonitor) FormatStats(s *SystemStats) string
type ProfileSnapshot ¶
ProfileSnapshot stores a profile taken during continuous profiling
type Profiler ¶
type Profiler struct {
KernelMonitor *KernelMonitor
// contains filtered or unexported fields
}
Profiler manages pprof and other diagnostic tools
func NewProfiler ¶
func NewProfiler(cfg config.PProfConfig) *Profiler
func (*Profiler) CaptureBlockProfile ¶
CaptureBlockProfile captures blocking profile
func (*Profiler) CaptureCPUProfile ¶
CaptureCPUProfile captures CPU profile for duration
func (*Profiler) CaptureGoroutineProfile ¶
CaptureGoroutineProfile captures current Goroutine profile
func (*Profiler) CaptureHeapProfile ¶
CaptureHeapProfile captures current Heap profile
func (*Profiler) CaptureMutexProfile ¶
CaptureMutexProfile captures mutex contention profile
func (*Profiler) CaptureThreadCreateProfile ¶
CaptureThreadCreateProfile captures thread creation profile
func (*Profiler) CaptureTrace ¶
CaptureTrace captures runtime trace
func (*Profiler) EnsureRunning ¶
EnsureRunning checks if pprof is accessible, if not and AutoStart is true, starts it.
func (*Profiler) GetRecentSnapshots ¶
func (p *Profiler) GetRecentSnapshots(duration time.Duration) []ProfileSnapshot
GetRecentSnapshots returns snapshots from the last duration
func (*Profiler) StartContinuous ¶
func (p *Profiler) StartContinuous()
StartContinuous starts the background loop for continuous profiling
func (*Profiler) StopContinuous ¶
func (p *Profiler) StopContinuous()
StopContinuous stops the background loop