feat(monitors): 实现 C 阶段网络存储电池监控与三语详情
This commit is contained in:
@@ -21,8 +21,23 @@ nonisolated struct MetricsSnapshot: Sendable {
|
||||
var date = Date()
|
||||
var cpu: CPUMetrics?
|
||||
var memory: MemoryMetrics?
|
||||
var network: [NetworkInterfaceMetrics]?
|
||||
var networkPath: NetworkPathStatus?
|
||||
var disk: DiskMetrics?
|
||||
var diskIO: DiskIOMetrics?
|
||||
var volumes: [VolumeMetrics]?
|
||||
var battery: BatteryMetrics?
|
||||
var load: [Double] = []
|
||||
var uptime: TimeInterval = 0
|
||||
// GPU remains unavailable until a reliable IOReport subscription is validated.
|
||||
var gpuUsage: Double? = nil
|
||||
}
|
||||
|
||||
nonisolated extension MetricsSnapshot {
|
||||
var downloadRate: Double? {
|
||||
guard let network else { return nil }
|
||||
let rates = network.compactMap(\.download)
|
||||
guard rates.count == network.count else { return nil }
|
||||
return rates.reduce(0, +)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user