Skip to content

Commit

Permalink
mem: add 0 check to darwin.swapmem.
Browse files Browse the repository at this point in the history
  • Loading branch information
若山史郎 authored and 若山史郎 committed Feb 26, 2015
1 parent 9569e23 commit cea341c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mem/mem_darwin.go
Expand Up @@ -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{
Expand Down

1 comment on commit cea341c

@afinkenstadt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Domo

Please sign in to comment.