add memory stats
This commit is contained in:
+8
-8
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user