fix(processes): 对齐活动监视器内存口径与显示单位

This commit is contained in:
2026-11-04 14:28:56 +08:00
parent 44f0415ab7
commit bbec1325a1
23 changed files with 195 additions and 26 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ import CoreGraphics
let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0)
let path: String? = index == 42 ? "/test/needle" : nil
return ProcessMetrics(id: id, name: "worker-\(index)",
path: path, cpu: Double(index), residentBytes: UInt64(2000 - index), threads: 1, restricted: false)
path: path, cpu: Double(index), footprintBytes: UInt64(2000 - index), threads: 1, restricted: false)
}
let cpu = ProcessTableProjection.rows(input, query: "", sorting: [ProcessSort(key: .cpu)], order: [])
precondition(cpu.first?.id.pid == 2000 && cpu.count == 2000)
@@ -46,7 +46,7 @@ import CoreGraphics
let ascending = ProcessTableProjection.rows(input, query: "", sorting: [ProcessSort(key: .cpu, order: .forward)], order: [])
precondition(ascending.first?.id.pid == 1)
let missing = ProcessMetrics(id: ProcessIdentity(pid: 3000, seconds: 1, microseconds: 0), name: "missing", path: nil,
cpu: nil, residentBytes: nil, threads: nil, restricted: true)
cpu: nil, footprintBytes: nil, threads: nil, restricted: true)
for direction in [SortOrder.forward, .reverse] {
for key in [ProcessSort.Key.cpu, .memory, .threads] {
let result = ProcessTableProjection.rows(input + [missing], query: "", sorting: [ProcessSort(key: key, order: direction)], order: [])