fix(processes): 对齐活动监视器内存口径与显示单位
This commit is contained in:
@@ -11,7 +11,7 @@ nonisolated struct ProcessMetrics: Identifiable, Sendable {
|
||||
let name: String
|
||||
let path: String?
|
||||
let cpu: Double? // One logical CPU = 100%; may exceed 1.
|
||||
let residentBytes: UInt64?
|
||||
let footprintBytes: UInt64? // Physical footprint; never RSS.
|
||||
let threads: Int?
|
||||
let restricted: Bool
|
||||
}
|
||||
@@ -41,3 +41,25 @@ nonisolated extension ProcessSnapshot {
|
||||
highestCPUProcesses(limit: 1).first
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated struct ProcessMemoryRequest: Codable, Sendable {
|
||||
let token: UUID
|
||||
let identities: [ProcessIdentity]
|
||||
static let limit = 256
|
||||
static let byteLimit = 65_536
|
||||
}
|
||||
nonisolated struct ProcessMemoryReading: Codable, Sendable {
|
||||
let id: ProcessIdentity
|
||||
let footprintBytes: UInt64?
|
||||
}
|
||||
nonisolated struct ProcessMemoryReply: Codable, Sendable {
|
||||
let token: UUID
|
||||
let readings: [ProcessMemoryReading]
|
||||
}
|
||||
nonisolated extension ProcessSnapshot {
|
||||
func withMemory(_ values: [ProcessIdentity: UInt64]) -> ProcessSnapshot {
|
||||
ProcessSnapshot(date: date, enumerated: enumerated, readable: readable,
|
||||
rows: rows.map { ProcessMetrics(id: $0.id, name: $0.name, path: $0.path, cpu: $0.cpu,
|
||||
footprintBytes: values[$0.id], threads: $0.threads, restricted: $0.restricted) }, failed: failed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user