1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

mem: add 0 check to darwin.swapmem.

This commit is contained in:
若山史郎 2015-02-26 16:23:35 +09:00
parent 9569e2389c
commit cea341c690

View File

@ -92,7 +92,10 @@ func SwapMemory() (*SwapMemoryStat, error) {
return nil, err
}
u := ((total_v - free_v) / total_v) * 100.0
u := float64(0)
if total_v != 0 {
u = ((total_v - free_v) / total_v) * 100.0
}
// vm.swapusage shows "M", multiply 1000
ret = &SwapMemoryStat{