Fix: wrong swap values on i686 / 4GB ram.
According to sysinfo manpages: swap fields need to be interpreted along with the mem_unit (Unit) field. See also http://stackoverflow.com/a/4229727
This commit is contained in:
parent
859c81da50
commit
36f47562c0
|
@ -70,8 +70,8 @@ func SwapMemory() (*SwapMemoryStat, error) {
|
|||
return nil, err
|
||||
}
|
||||
ret := &SwapMemoryStat{
|
||||
Total: uint64(sysinfo.Totalswap),
|
||||
Free: uint64(sysinfo.Freeswap),
|
||||
Total: uint64(sysinfo.Totalswap) * uint64(sysinfo.Unit),
|
||||
Free: uint64(sysinfo.Freeswap) * uint64(sysinfo.Unit),
|
||||
}
|
||||
ret.Used = ret.Total - ret.Free
|
||||
//check Infinity
|
||||
|
|
Loading…
Reference in New Issue