xmtop/devices/mem_mem.go
Sean E. Russell 7a89225d72 Abstracts CPU & mem devices.
Finishes device refactoring: temps

Refactoring to allow updating maps. Simpler, and optimizable.
2020-02-28 07:06:51 -06:00

22 lines
422 B
Go

package devices
import (
psMem "github.com/shirou/gopsutil/mem"
)
func init() {
mf := func(mems map[string]MemoryInfo) map[string]error {
mainMemory, err := psMem.VirtualMemory()
if err != nil {
return map[string]error{"Main": err}
}
mems["Main"] = MemoryInfo{
Total: mainMemory.Total,
Used: mainMemory.Used,
UsedPercent: mainMemory.UsedPercent,
}
return nil
}
RegisterMem(mf)
}