Skip to content

Commit 5186f47

Browse files
committed
fix: swap usage compute error
1 parent 04bf6d7 commit 5186f47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/api/analytic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func getMemoryStat() (MemStat, error) {
7272
SwapTotal: humanize.Bytes(memoryStat.SwapTotal),
7373
SwapCached: humanize.Bytes(memoryStat.SwapCached),
7474
SwapPercent: cast.ToFloat64(fmt.Sprintf("%.2f",
75-
float64(memoryStat.SwapFree)/math.Max(float64(memoryStat.SwapTotal), 1))),
75+
100*float64(memoryStat.SwapTotal-memoryStat.SwapFree)/math.Max(float64(memoryStat.SwapTotal), 1))),
7676
Pressure: cast.ToFloat64(fmt.Sprintf("%.2f", memoryStat.UsedPercent)),
7777
}, nil
7878
}

0 commit comments

Comments
 (0)