26 lines
591 B
Swift
26 lines
591 B
Swift
import Foundation
|
|
|
|
nonisolated struct ProcessIdentity: Hashable, Sendable {
|
|
let pid: Int32
|
|
let seconds: UInt64
|
|
let microseconds: UInt64
|
|
}
|
|
|
|
nonisolated struct ProcessMetrics: Identifiable, Sendable {
|
|
let id: ProcessIdentity
|
|
let name: String
|
|
let path: String?
|
|
let cpu: Double? // One logical CPU = 100%; may exceed 1.
|
|
let residentBytes: UInt64?
|
|
let threads: Int?
|
|
let restricted: Bool
|
|
}
|
|
|
|
nonisolated struct ProcessSnapshot: Sendable {
|
|
let date: Date
|
|
let enumerated: Int
|
|
let readable: Int
|
|
let rows: [ProcessMetrics]
|
|
let failed: Bool
|
|
}
|