feat(menubar): 支持固定居中面板与独立刷新频率及图表浮层
This commit is contained in:
@@ -13,6 +13,7 @@ nonisolated struct TrendSample: Sendable {
|
||||
var write: Double?
|
||||
var cpuUser: Double?
|
||||
var cpuSystem: Double?
|
||||
var breakBefore = false
|
||||
}
|
||||
|
||||
/// Bounded sampling history; no timer or UI visibility dependence.
|
||||
@@ -21,13 +22,13 @@ nonisolated struct MetricHistory: Sendable {
|
||||
private(set) var samples: [TrendSample] = []
|
||||
private(set) var interfaces: [String: [InterfaceTrendSample]] = [:]
|
||||
|
||||
mutating func append(_ snapshot: MetricsSnapshot) {
|
||||
mutating func append(_ snapshot: MetricsSnapshot, breakBefore: Bool = false) {
|
||||
samples.append(TrendSample(date: snapshot.date, cpu: snapshot.cpu?.usage,
|
||||
gpu: snapshot.gpuUsage, memory: snapshot.memory?.usage,
|
||||
download: snapshot.downloadRate, disk: snapshot.disk?.usage,
|
||||
battery: snapshot.battery?.charge, upload: snapshot.uploadRate,
|
||||
read: snapshot.diskIO?.read, write: snapshot.diskIO?.written,
|
||||
cpuUser: snapshot.cpu?.user, cpuSystem: snapshot.cpu?.system))
|
||||
cpuUser: snapshot.cpu?.user, cpuSystem: snapshot.cpu?.system, breakBefore: breakBefore))
|
||||
let current = snapshot.network ?? []
|
||||
let keys = Set(current.map(\.identity))
|
||||
interfaces = interfaces.filter { keys.contains($0.key) }
|
||||
|
||||
Reference in New Issue
Block a user