xmtop/devices/mem_swap_other.go
寻觅 9dcbd2a48e
Some checks failed
Build Go binaries / build (push) Has been cancelled
[修复] 更新依赖, 修复龙架构无法正常编译的问题
2024-09-13 15:08:35 +08:00

24 lines
426 B
Go

// +build !freebsd
package devices
import (
psMem "github.com/shirou/gopsutil/v3/mem"
)
func init() {
mf := func(mems map[string]MemoryInfo) map[string]error {
memory, err := psMem.SwapMemory()
if err != nil {
return map[string]error{"Swap": err}
}
mems["Swap"] = MemoryInfo{
Total: memory.Total,
Used: memory.Used,
UsedPercent: memory.UsedPercent,
}
return nil
}
RegisterMem(mf)
}