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:
Luca Berruti 2016-09-04 11:57:16 +02:00
parent 859c81da50
commit 36f47562c0
1 changed files with 2 additions and 2 deletions

View File

@ -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