mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: moved from binary to metric based size units to have the same calculation as macOS (#2230)
This commit is contained in:
@@ -193,6 +193,9 @@ public class ProcessReader: Reader<[TopProcess]> {
|
||||
usage *= 1024 // apply gigabyte multiplier
|
||||
} else if usageString.last == "K" {
|
||||
usage /= 1024 // apply kilobyte divider
|
||||
} else if usageString.last == "M" && usageString.count == 5 {
|
||||
usage /= 1024
|
||||
usage *= 1000
|
||||
}
|
||||
|
||||
var name: String = command
|
||||
@@ -200,6 +203,6 @@ public class ProcessReader: Reader<[TopProcess]> {
|
||||
name = n
|
||||
}
|
||||
|
||||
return TopProcess(pid: pid, name: name, usage: usage * Double(1024 * 1024))
|
||||
return TopProcess(pid: pid, name: name, usage: usage * Double(1000 * 1000))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user