diff --git a/mem/mem_linux.go b/mem/mem_linux.go index fe6c4e1..33b2490 100644 --- a/mem/mem_linux.go +++ b/mem/mem_linux.go @@ -70,8 +70,8 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { if !memavail { ret.Available = ret.Free + ret.Buffers + ret.Cached } - ret.Used = ret.Total - ret.Available - ret.UsedPercent = float64(ret.Total-ret.Available) / float64(ret.Total) * 100.0 + ret.Used = ret.Total - ret.Free - ret.Buffers - ret.Cached + ret.UsedPercent = float64(ret.Used) / float64(ret.Total) * 100.0 return ret, nil }