xmtop/widgets/mem_other.go
2020-02-13 10:15:52 -06:00

23 lines
435 B
Go

// +build !freebsd
package widgets
import (
"log"
psMem "github.com/shirou/gopsutil/mem"
)
func (self *MemWidget) updateSwapMemory() {
swapMemory, err := psMem.SwapMemory()
if err != nil {
log.Printf("failed to get swap memory info from gopsutil: %v", err)
} else {
self.renderMemInfo("Swap", MemoryInfo{
Total: swapMemory.Total,
Used: swapMemory.Used,
UsedPercent: swapMemory.UsedPercent,
})
}
}