refactor(project): 清理闲置展示链路与重复采样状态
This commit is contained in:
@@ -29,12 +29,10 @@ import Foundation
|
||||
precondition(MetricFormat.watts(12.34) == "12.3 W")
|
||||
var extended = MetricsSnapshot()
|
||||
extended.network = [NetworkInterfaceMetrics(name: "en0", received: 100, sent: 50, download: 20, upload: 10)]
|
||||
extended.disk = DiskMetrics(total: 100, available: 40)
|
||||
extended.battery = BatteryMetrics(charge: 0.8, charging: false, externalPower: true, power: 0)
|
||||
var extendedHistory = MetricHistory()
|
||||
extendedHistory.append(extended)
|
||||
precondition(extendedHistory.samples.last?.download == 20)
|
||||
precondition(extendedHistory.samples.last?.disk == 0.6)
|
||||
precondition(extendedHistory.samples.last?.battery == 0.8)
|
||||
precondition(extendedHistory.samples.last?.batteryPower == 0)
|
||||
extended.battery?.power = 12.5
|
||||
@@ -105,7 +103,6 @@ import Foundation
|
||||
precondition(cpu.cores.count == ProcessInfo.processInfo.processorCount)
|
||||
precondition(memory.total == ProcessInfo.processInfo.physicalMemory)
|
||||
precondition(memory.used <= memory.total)
|
||||
precondition(sampled.load.count == 3)
|
||||
await sampler.reset()
|
||||
let reset = await sampler.sample()
|
||||
precondition(reset.cpu == nil)
|
||||
@@ -130,7 +127,7 @@ import Foundation
|
||||
precondition(store.snapshot.cpu != nil)
|
||||
store.togglePause()
|
||||
print("PASS: store publishes, pause freezes snapshot, resume resets baseline")
|
||||
print("PASS: CPU deltas, wraparound, invalid data, first sample, reset, live CPU/memory/load")
|
||||
print("PASS: CPU deltas, wraparound, invalid data, first sample, reset, live CPU/memory")
|
||||
print("Live CPU: \(cpu.usage), memory: \(memory.used)/\(memory.total), swap: \(String(describing: memory.swapUsed)), pressure: \(String(describing: memory.pressure))")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user