feat(menubar): 完善首排监控卡片与温度风扇采样
补充 GPU 渲染分块、内存与利用率统计,增加只读 SMC 温度及风扇信息和旋转动效。完善电池功率与耗电进程列表,统一首排布局并固定异步加载区域高度。同步验证用例、架构说明和 GPU 能力调研工具。
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import Foundation
|
||||
|
||||
@main struct FanChecks {
|
||||
static func main() {
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0x666c7420, bytes: [0, 0, 0, 0]) == 0)
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0x66706532, bytes: [0x24, 0x34]) == 2317)
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0x75693820, bytes: [2]) == 2)
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0x666c7420, bytes: [0, 0, 0xc0, 0x7f]) == nil)
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0x666c7420, bytes: [0]) == nil)
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0, bytes: []) == nil)
|
||||
precondition(FanMetrics.validRPM(0) == 0)
|
||||
for value in [Double.nan, .infinity, -1, 30_001] { precondition(FanMetrics.validRPM(value) == nil) }
|
||||
precondition(FanRotation.speed(rpm: 0, reducedMotion: false) == 0)
|
||||
precondition(FanRotation.speed(rpm: nil, reducedMotion: false) == 0)
|
||||
precondition(FanRotation.speed(rpm: .nan, reducedMotion: false) == 0)
|
||||
precondition(FanRotation.speed(rpm: 6000, reducedMotion: true) == 0)
|
||||
let tiers = [1000.0, 3000, 5000, 7000].map { FanRotation.speed(rpm: $0, reducedMotion: false) }
|
||||
precondition(zip(tiers, tiers.dropFirst()).allSatisfy { $0 < $1 })
|
||||
var rotation = FanRotation()
|
||||
rotation.update(rpm: 1000, reducedMotion: false, at: 100)
|
||||
let before = rotation.angle(at: 101)
|
||||
rotation.update(rpm: 7000, reducedMotion: false, at: 101)
|
||||
precondition(rotation.angle(at: 101) == before)
|
||||
rotation.update(rpm: 0, reducedMotion: false, at: 102)
|
||||
precondition(rotation.angle(at: 102) == rotation.angle(at: 200))
|
||||
rotation.update(rpm: 7000, reducedMotion: true, at: 200)
|
||||
precondition(rotation.angle(at: 200) == rotation.angle(at: 300))
|
||||
print("PASS: fan decoding, invalid RPM, speed tiers, continuous phase and stop/reduced-motion")
|
||||
print("Live fan RPM:", CPUTemperatureMonitor().sampleFans() as Any)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user