Documentation
¶
Overview ¶
GPU polling shared across platforms: the cache cadence lives here and the probe is platform-specific (NVML everywhere except darwin).
Package collector polls system metrics into serializable snapshots. Snapshot fields are plain data so the struct can later cross a wire unchanged (remote monitoring is planned post-v1).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Battery ¶
Battery is the main battery state; a nil pointer means the machine has no battery (or the platform does not report one).
type CPU ¶
type CPU struct {
Percent float64 `json:"percent"`
FreqMHz float64 `json:"freq_mhz,omitempty"`
Cores []float64 `json:"cores"`
}
CPU is one CPU sample. Percent is the aggregate across all logical cores; Cores holds one percentage per logical core. FreqMHz is the current average clock and is 0 when the platform does not report it.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector polls system metrics on demand. It is safe for concurrent use. The zero value is usable; use New to size the slow-metric cadence.
type Conn ¶
type Conn struct {
Local string `json:"local"` // ip:port (IPv6 bracketed)
Remote string `json:"remote"` // ip:port, zero port for listeners
State string `json:"state"`
PID int32 `json:"pid,omitempty"`
}
Conn is one live TCP connection from the socket table. PID is best-effort — some platforms only resolve it with privileges, so it may stay zero and the process column renders as "—".
type Disk ¶
type Disk struct {
Device string `json:"device"`
Mountpoint string `json:"mountpoint"`
FSType string `json:"fs_type"`
Total uint64 `json:"total"`
Used uint64 `json:"used"`
Free uint64 `json:"free"`
Percent float64 `json:"percent"`
}
Disk is one mounted filesystem.
type DiskIO ¶
type DiskIO struct {
Name string `json:"name"`
ReadBytes float64 `json:"read_bytes_per_s"`
WriteBytes float64 `json:"write_bytes_per_s"`
ReadIOPS float64 `json:"read_iops"`
WriteIOPS float64 `json:"write_iops"`
BusyPercent float64 `json:"busy_percent"`
}
DiskIO is a per-device I/O rate sample (interval delta).
type GPU ¶
type GPU struct {
Index int `json:"index"`
Name string `json:"name"`
Util float64 `json:"util_percent"`
MemUsed uint64 `json:"mem_used"`
MemTotal uint64 `json:"mem_total"`
TempC float64 `json:"temp_c"`
}
GPU is one graphics adapter reading. Util is the percent of the whole adapter; memory figures are the adapter's own VRAM. A nil slice means no GPU reporting is available (or no adapter exists).
type Host ¶
type Host struct {
Hostname string `json:"hostname"`
OS string `json:"os"`
Platform string `json:"platform"`
Kernel string `json:"kernel"`
Arch string `json:"arch"`
Uptime time.Duration `json:"uptime"`
Procs int `json:"procs"`
Load [3]float64 `json:"load"`
Users int `json:"users"` // logged-in sessions
}
Host holds slow-changing system identity plus volatile load figures.
type Mem ¶
type Mem struct {
Total uint64 `json:"total"`
Used uint64 `json:"used"`
Available uint64 `json:"available"`
Percent float64 `json:"percent"`
SwapTotal uint64 `json:"swap_total"`
SwapUsed uint64 `json:"swap_used"`
SwapPercent float64 `json:"swap_percent"`
ZramTotal uint64 `json:"zram_total,omitempty"` // linux: compressed swap device
ZramUsed uint64 `json:"zram_used,omitempty"`
}
Mem is one memory sample.
type NetIface ¶
type NetIface struct {
Name string `json:"name"`
RxRate float64 `json:"rx_rate"` // bytes/s
TxRate float64 `json:"tx_rate"` // bytes/s
RxRatePackets float64 `json:"rx_pps"`
TxRatePackets float64 `json:"tx_pps"`
RxDrop float64 `json:"rx_drops"` // drops/s
TxDrop float64 `json:"tx_drops"` // drops/s
RxTotal uint64 `json:"rx_total"`
TxTotal uint64 `json:"tx_total"`
}
NetIface is a per-interface traffic sample (rates are interval deltas).
type Proc ¶
type Proc struct {
PID int32 `json:"pid"`
PPID int32 `json:"ppid"`
Name string `json:"name"`
CPU float64 `json:"cpu"`
Mem float64 `json:"mem"` // percent of physical memory
RSS uint64 `json:"rss"`
User string `json:"user"`
State string `json:"state"` // single letter: R S Z T I ...
Threads int32 `json:"threads"`
Nice int8 `json:"nice"`
}
Proc is one process sample. CPU is an interval delta (htop-style) and can exceed 100 for multi-threaded processes.
type Snapshot ¶
type Snapshot struct {
Time time.Time `json:"time"`
Host Host `json:"host"`
CPU CPU `json:"cpu"`
Mem Mem `json:"mem"`
Sensors []Sensor `json:"sensors,omitempty"`
Fans []Fan `json:"fans,omitempty"`
Battery *Battery `json:"battery,omitempty"`
GPUs []GPU `json:"gpus,omitempty"`
Procs []Proc `json:"procs,omitempty"`
Disks []Disk `json:"disks,omitempty"`
DiskIOs []DiskIO `json:"disk_ios,omitempty"`
Nets []NetIface `json:"nets,omitempty"`
Conns []Conn `json:"conns,omitempty"`
}
Snapshot is one sample of everything wrongtop shows.
type SnapshotMsg ¶
type SnapshotMsg struct {
Snap Snapshot
}
SnapshotMsg wraps a Snapshot for the bubbletea event loop.