summaryrefslogtreecommitdiff
path: root/status/03-mem.go
diff options
context:
space:
mode:
authorhhvn <dev@hhvn.uk>2024-04-14 13:49:18 +0100
committerhhvn <dev@hhvn.uk>2024-04-14 13:49:18 +0100
commit612e4fbeb14001d5eef0bb0e3e19ea65eb47cef2 (patch)
treec000b5997dabcfe424af25b694a6c05356c03622 /status/03-mem.go
parent75a34eb4b035963970c8415316c2b2bd6a81eea6 (diff)
Tidy up the status block api a bit
Handle (nearly) all the plumbing (sleeps, goroutines and comms) in register()
Diffstat (limited to 'status/03-mem.go')
-rw-r--r--status/03-mem.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/status/03-mem.go b/status/03-mem.go
index e33b879..2ae7bef 100644
--- a/status/03-mem.go
+++ b/status/03-mem.go
@@ -15,9 +15,7 @@ func checkMemField(m map[string]int, k string) error {
return nil
}
-func mem(name string) error {
- u := newUpdate(name)
-
+func mem(u *Block) error {
mem := make(map[string]int)
lines, err := common.FileAsLines("/proc/meminfo")
@@ -44,13 +42,9 @@ func mem(name string) error {
cx += u.drawPercentBar(cx, p)
_, err = u.drawText(cx, blendGYR(p), fmt.Sprintf("%d%%", p))
- updates <- u
-
- sleep(1)
-
return nil
}
func init() {
- register("mem", mem)
+ register("mem", mem, 1)
}