feat(menubar): 完善首排监控卡片与温度风扇采样
补充 GPU 渲染分块、内存与利用率统计,增加只读 SMC 温度及风扇信息和旋转动效。完善电池功率与耗电进程列表,统一首排布局并固定异步加载区域高度。同步验证用例、架构说明和 GPU 能力调研工具。
This commit is contained in:
@@ -8,6 +8,16 @@ import Foundation
|
||||
precondition(ProcessMonitor.cpu(current: 1, previous: 0, elapsed: 0) == nil)
|
||||
precondition(GPUMonitor.normalized(53) == 0.53)
|
||||
precondition(GPUMonitor.normalized(101) == nil && GPUMonitor.normalized(.nan) == nil)
|
||||
let processRows = [
|
||||
ProcessMetrics(id: ProcessIdentity(pid: 1, seconds: 1, microseconds: 1), name: "unknown", path: nil, cpu: nil, residentBytes: nil, threads: nil, restricted: true),
|
||||
ProcessMetrics(id: ProcessIdentity(pid: 2, seconds: 1, microseconds: 2), name: "busy", path: nil, cpu: 2.5, residentBytes: nil, threads: nil, restricted: false),
|
||||
ProcessMetrics(id: ProcessIdentity(pid: 3, seconds: 1, microseconds: 3), name: "idle", path: nil, cpu: 0, residentBytes: nil, threads: nil, restricted: false),
|
||||
ProcessMetrics(id: ProcessIdentity(pid: 4, seconds: 1, microseconds: 4), name: "invalid", path: nil, cpu: -.infinity, residentBytes: nil, threads: nil, restricted: false)
|
||||
]
|
||||
let processSnapshot = ProcessSnapshot(date: Date(), enumerated: 4, readable: 3, rows: processRows, failed: false)
|
||||
precondition(processSnapshot.highestCPUProcess?.name == "busy")
|
||||
precondition(processSnapshot.highestCPUProcesses(limit: 3).map(\.name) == ["busy", "idle"])
|
||||
precondition(processSnapshot.highestCPUProcesses(limit: 0).isEmpty)
|
||||
var snapshot = MetricsSnapshot()
|
||||
snapshot.network = [NetworkInterfaceMetrics(name: "en0", received: 1, sent: 1, download: 12, upload: 8),
|
||||
NetworkInterfaceMetrics(name: "utun0", received: 1, sent: 1, download: 99, upload: 99)]
|
||||
|
||||
Reference in New Issue
Block a user