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:
parent
9569e2389c
commit
cea341c690
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user