system

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AMDGPUSysfsPath = "/sys/class/drm"

AMDGPUSysfsPath is the sysfs base used to discover AMD GPUs.

Variables

This section is empty.

Functions

func HasAMDGPU

func HasAMDGPU() bool

HasAMDGPU reports whether a card with mem_info_vram_total exists under AMDGPUSysfsPath.

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.

Jump to

Keyboard shortcuts

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