feat(menubar): 拆分紧凑双页面板并按页采样
This commit is contained in:
@@ -35,6 +35,18 @@ nonisolated struct ProcessEnergySnapshot: Sendable {
|
||||
let candidates: Int
|
||||
let readable: Int
|
||||
let measured: Int
|
||||
let rows: [ProcessEnergyUsage] // Only the top three; no CPU prefilter.
|
||||
let rows: [ProcessEnergyUsage] // All valid measurements; no CPU prefilter.
|
||||
let state: State
|
||||
}
|
||||
|
||||
nonisolated extension ProcessSnapshot {
|
||||
func withEnergy(_ energy: ProcessEnergySnapshot?) -> ProcessSnapshot {
|
||||
let values = Dictionary((energy?.rows ?? []).map { ($0.id, $0) }, uniquingKeysWith: { first, _ in first })
|
||||
return ProcessSnapshot(date: date, enumerated: enumerated, readable: readable, rows: rows.map { process in
|
||||
var row = process
|
||||
row.cpuPower = values[process.id]?.watts
|
||||
row.powerWindow = values[process.id]?.seconds
|
||||
return row
|
||||
}, failed: failed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user