Documentation
¶
Index ¶
Constants ¶
const AMDGPUSysfsPath = "/sys/class/drm"
AMDGPUSysfsPath is the sysfs base used to discover AMD GPUs.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GPUMonitor ¶
type GPUMonitor struct {
// contains filtered or unexported fields
}
GPUMonitor probes for an attached GPU (NVIDIA / AMD / Intel) and reports VRAM usage. Detection is cached for gpuDetectionTTL; once a vendor is detected, subsequent Stats calls invoke the vendor-specific tool directly.
func NewGPUMonitor ¶
func NewGPUMonitor(enabled bool, configuredType string) *GPUMonitor
NewGPUMonitor creates a monitor. enabled gates Stats; when false, Stats returns (nil, nil). configuredType is the user-pinned vendor ("nvidia"|"amd"|"intel"|"auto"|"") — anything else falls back to auto-detection.
func (*GPUMonitor) Enabled ¶
func (m *GPUMonitor) Enabled() bool
Enabled reports whether GPU monitoring is on.
func (*GPUMonitor) Stats ¶
func (m *GPUMonitor) Stats(ctx context.Context) ([]systemtypes.GPUStats, error)
Stats returns per-GPU VRAM stats. Returns (nil, 0, nil) when monitoring is disabled or no GPU is detected; vendor-specific errors are propagated otherwise.