add memory stats

This commit is contained in:
alu
2026-08-06 11:58:34 -07:00
parent 0998633e5c
commit b99bb45877
14 changed files with 448 additions and 143 deletions
+8 -8
View File
@@ -1,8 +1,8 @@
package app
import (
"finally-a-monolithic-linux-hw-monitor/app/cpu"
"finally-a-monolithic-linux-hw-monitor/app/cpu/proc"
"finally-a-monolithic-linux-hw-monitor/app/mem"
proc "finally-a-monolithic-linux-hw-monitor/app/proc"
"fmt"
"os"
"os/signal"
@@ -25,18 +25,18 @@ func Run() {
os.Exit(0)
}()
proc, err := proc.GetProc()
p, _ := proc.GetProc()
m, _ := mem.GetMem()
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
for {
console := &strings.Builder{}
// Move cursor to top-left (0,0) without clearing full buffer (flicker-free)
fmt.Fprint(console, "\033[H")
if err != nil {
return
}
cpu.RenderCPU(console, &proc)
proc.RenderProc(console, &p)
mem.RenderMem(console, &m)
fmt.Fprint(console, "\nPress Ctrl+C to exit.\033[K\n")
fmt.Print(console.String())