feat(ui): 实现全卡堆叠趋势与单页资源进程布局

This commit is contained in:
2026-11-15 17:59:52 +08:00
parent 469766892d
commit 99e558625b
37 changed files with 579 additions and 195 deletions
+6 -6
View File
@@ -13,17 +13,17 @@ import Foundation
store.setPanelVisible(true)
try await until { store.history.samples.count >= 2 }
precondition(probe.count == 0 && store.processSnapshot == nil && store.energy == nil,
"Overview must not enumerate processes or publish process power")
store.setDetailDemand(processes: true, slowMetrics: false)
"Disabled process demand must not enumerate processes or publish process power")
store.setDetailDemand(processes: true, slowMetrics: true)
try await until { probe.count > 0 }
// Withdraw demand while the synchronous OS read still holds the single slot.
store.setDetailDemand(processes: false, slowMetrics: true)
try await Task.sleep(for: .milliseconds(350))
precondition(store.processSnapshot == nil, "A completion from the previous page must not publish")
precondition(store.processSnapshot == nil, "A completion from the withdrawn demand must not publish")
let stopped = probe.count
try await Task.sleep(for: .milliseconds(650))
precondition(probe.count == stopped && store.snapshot.cpu != nil)
store.setDetailDemand(processes: true, slowMetrics: false)
store.setDetailDemand(processes: true, slowMetrics: true)
try await until { store.processSnapshot != nil }
precondition(probe.peak == 1)
precondition(store.history.samples.dropFirst().allSatisfy { !$0.breakBefore && $0.cpu != nil },
@@ -32,7 +32,7 @@ import Foundation
precondition(store.processSnapshot == nil && store.energy == nil)
store.togglePause()
let pausedCount = store.history.samples.count
store.setDetailDemand(processes: true, slowMetrics: false)
store.setDetailDemand(processes: true, slowMetrics: true)
try await Task.sleep(for: .milliseconds(650))
precondition(store.history.samples.count == pausedCount && store.processSnapshot == nil)
store.togglePause()
@@ -40,7 +40,7 @@ import Foundation
store.setPanelVisible(false)
precondition(store.processSnapshot == nil && store.energy == nil)
store.togglePause()
print("PASS: overview performs no process reads, page withdrawal rejects stale completion, single in-flight read, continuous base history and pause/hidden precedence")
print("PASS: disabled demand performs no process reads, unified demand supports both details, withdrawal rejects stale completion, single in-flight read, continuous base history and pause/hidden precedence")
}
@MainActor private static func until(_ condition: () -> Bool) async throws {