fix: fixed RAM top processes parsing (#697)

This commit is contained in:
Serhiy Mytrovtsiy
2021-11-18 16:59:48 +01:00
parent 5d4a55c398
commit 76166f2f53

View File

@@ -158,9 +158,9 @@ public class ProcessReader: Reader<[TopProcess]> {
let pid = Int(pidString.filter("01234567890.".contains)) ?? 0
var usage = Double(usageString.filter("01234567890.".contains)) ?? 0
if usageString.contains("G") && usageString.first != "G" {
if usageString.last == "G" {
usage *= 1024 // apply gigabyte multiplier
} else if usageString.contains("K") && usageString.first != "K" {
} else if usageString.last == "K" {
usage /= 1024 // apply kilobyte divider
}