summaryrefslogtreecommitdiff
path: root/internal/collector/types.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-13 22:52:46 +0200
committerPaul Buetow <paul@buetow.org>2026-02-13 22:52:46 +0200
commitcd5a3614baab756a41d764b79308afeea93f12dd (patch)
treeefc8c31e8b162ca2121ba92c841322119e6d3b04 /internal/collector/types.go
parentbf7c6ade292a6444877797c8d699d147aceb57cc (diff)
Remove Perl version and build files; add .gitignore for .serena/
Amp-Thread-ID: https://ampcode.com/threads/T-019c58b3-06fb-733d-8fc1-f268fe7f70d5 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/collector/types.go')
-rw-r--r--internal/collector/types.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/collector/types.go b/internal/collector/types.go
new file mode 100644
index 0000000..1b10979
--- /dev/null
+++ b/internal/collector/types.go
@@ -0,0 +1,36 @@
+package collector
+
+// CPULine is one line of /proc/stat: cpu name + counters (user, nice, system, idle, ...).
+type CPULine struct {
+ Name string
+ User, Nice, System, Idle, Iowait, IRQ, SoftIRQ, Steal, Guest, GuestNice int64
+}
+
+// Total returns sum of all CPU counters.
+func (c *CPULine) Total() int64 {
+ return c.User + c.Nice + c.System + c.Idle + c.Iowait + c.IRQ + c.SoftIRQ + c.Steal + c.Guest + c.GuestNice
+}
+
+// MemLine is one key from /proc/meminfo (e.g. MemTotal, MemFree).
+type MemLine struct {
+ Key string
+ Value int64
+}
+
+// NetLine is one interface line: iface and key=value pairs (b, tb, p, tp, e, te, d, td).
+type NetLine struct {
+ Iface string
+ B int64 // rx bytes
+ Tb int64 // tx bytes
+ P int64
+ Tp int64
+ E int64
+ Te int64
+ D int64
+ Td int64
+}
+
+// LoadAvg is 1/5/15 min load average.
+type LoadAvg struct {
+ Load1, Load5, Load15 string
+}