fix(processes): 对齐活动监视器内存口径与显示单位
This commit is contained in:
@@ -63,7 +63,7 @@ nonisolated struct ProcessMonitor: Sendable {
|
||||
}
|
||||
}
|
||||
rows.append(ProcessMetrics(id: id, name: name, path: path,
|
||||
cpu: usage, residentBytes: valid ? info.ptinfo.pti_resident_size : nil,
|
||||
cpu: usage, footprintBytes: nil,
|
||||
threads: valid ? Int(info.ptinfo.pti_threadnum) : nil, restricted: !valid))
|
||||
}
|
||||
// Recheck the enumeration identity after path reads; never attach a reused PID's path.
|
||||
@@ -76,7 +76,7 @@ nonisolated struct ProcessMonitor: Sendable {
|
||||
} else {
|
||||
paths = [:]
|
||||
rows = rows.map { ProcessMetrics(id: $0.id, name: $0.name, path: nil, cpu: $0.cpu,
|
||||
residentBytes: $0.residentBytes, threads: $0.threads, restricted: $0.restricted) }
|
||||
footprintBytes: $0.footprintBytes, threads: $0.threads, restricted: $0.restricted) }
|
||||
}
|
||||
let retained = Set(rows.map(\.id))
|
||||
previous = next.filter { retained.contains($0.key) }
|
||||
|
||||
@@ -161,7 +161,8 @@ actor SystemSampler {
|
||||
processTask = Task.detached(priority: .utility) { [self] in
|
||||
var worker = monitor
|
||||
let value = read(&worker)
|
||||
await finishProcesses(value, monitor: worker, generation: generation)
|
||||
let memory = await ProcessMemoryServiceClient.read(value.rows.map(\.id))
|
||||
await finishProcesses(value.withMemory(memory), monitor: worker, generation: generation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user