Skip to content

Commit 1115400

Browse files
committed
#12 opt.: used = total - avail
1 parent 96ae29b commit 1115400

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

model/status.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,24 +230,19 @@ func ParseMemAndSwapStatus(s string) error {
230230
switch true {
231231
case strings.HasPrefix(line, "MemTotal:"):
232232
Status.Mem.Total = size
233-
fallthrough
234233
case strings.HasPrefix(line, "MemFree:"):
235234
Status.Mem.Free = size
236-
Status.Mem.Used = Status.Mem.Total - Status.Mem.Free
237-
fallthrough
238235
case strings.HasPrefix(line, "MemAvailable:"):
239236
Status.Mem.Avail = size
240237
case strings.HasPrefix(line, "SwapTotal:"):
241238
Status.Swap.Total = size
242-
fallthrough
243239
case strings.HasPrefix(line, "SwapFree:"):
244240
Status.Swap.Free = size
245-
Status.Swap.Used = Status.Swap.Total - Status.Swap.Free
246-
fallthrough
247241
case strings.HasPrefix(line, "SwapCached:"):
248-
Status.Swap.Cached = size
242+
Status.Swap.Used = size
249243
}
250244
}
245+
Status.Mem.Used = Status.Mem.Total - Status.Mem.Avail
251246
return nil
252247
}
253248

0 commit comments

Comments
 (0)