Documentation
¶
Overview ¶
Package cpumon provides CPU utilization monitoring with platform-specific implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("cpumon: monitor closed")
ErrClosed is returned by Sample after the monitor has been closed.
Functions ¶
This section is empty.
Types ¶
type CPUSample ¶
CPUSample is a point-in-time CPU utilization measurement. It is an alias of the public engine.CPUSample so the internal implementations (ProcStat, RuntimeMon) directly satisfy the public engine.CPUMonitor interface and can be passed into adaptive.New from outside the module.
type Monitor ¶
type Monitor = engine.CPUMonitor
Monitor samples CPU utilization. It is an alias of the public engine.CPUMonitor interface, keeping internal/cpumon as the implementation while the type surfaced in public signatures lives in the engine root.
type ProcStat ¶
type ProcStat struct {
// contains filtered or unexported fields
}
ProcStat reads CPU utilization from /proc/stat.
A single ProcStat is sampled by more than one goroutine in an adaptive setup (the live sampler and the observe collector share one instance), so all mutable state — the shared file handle, the delta accumulators, and the closed flag — is guarded by mu.
func NewProcStat ¶
NewProcStat creates a /proc/stat-based CPU monitor.
type Synthetic ¶
type Synthetic struct {
// contains filtered or unexported fields
}
Synthetic is a deterministic CPU monitor for testing.
func NewSynthetic ¶
NewSynthetic creates a synthetic monitor with initial utilization.