feat(panel): 调整资源卡片读数布局并保留趋势平移

逐核显示 CPU 占用,在 GPU 标题展示核数并补充分项读数。无电池设备显示整机功率。

存储与网络将曲线排在详情下方,CPU、GPU、内存和电池保留整卡趋势。数值直接刷新,曲线随采样平滑平移。顶栏展示版本号,底栏调整开机时间和刷新间隔。
This commit is contained in:
2026-11-15 22:03:46 +08:00
parent c886c4227d
commit 6300db3d15
27 changed files with 427 additions and 250 deletions
+6 -7
View File
@@ -10,14 +10,14 @@ import SwiftUI
precondition(last > 0 && first - last <= 1)
let columns = rows.max()!
let cellWidth = (width - Double(columns - 1) * 3) / Double(columns)
precondition(cellWidth >= 6, "Each real core needs its own visible meter cell")
precondition(cellWidth >= 7, "Each real core needs its own visible meter cell")
}
}
}
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 430) == [18])
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 280) == [18])
precondition(CPUCoreGridLayout.rowCounts(count: 32, width: 430) == [32])
precondition(CPUCoreGridLayout.rowCounts(count: 48, width: 430) == [48])
precondition(CPUCoreGridLayout.rowCounts(count: 48, width: 430) == [24, 24])
for count in [0, 1, 4, 8, 14, 18, 24, 32, 48, 128] {
let kinds = Dictionary(uniqueKeysWithValues: (0..<count).map { ($0, $0 < count / 3 ? CPUCoreTopology.Kind.efficiency : .performance) })
let groups = CPUCoreGrid.groups(count: count, kinds: kinds)
@@ -37,11 +37,10 @@ import SwiftUI
precondition(CPUCoreGridLayout.rowCounts(count: 128, width: width).reduce(0, +) == 128)
}
precondition(CPUCoreGrid.groups(count: 3, kinds: [0: .efficiency]).count == 2)
precondition(SegmentedCoreBar.portions(0) == [0,0,0,0])
precondition(SegmentedCoreBar.portions(0.125) == [0.5,0,0,0])
precondition(SegmentedCoreBar.portions(0.5) == [1,1,0,0])
precondition(SegmentedCoreBar.portions(1) == [1,1,1,1])
for invalid: Double? in [nil,.nan,-1] { precondition(SegmentedCoreBar.portions(invalid) == [0,0,0,0]) }
let m4 = CPUCoreGrid.groups(count: 14, kinds: Dictionary(uniqueKeysWithValues:
(0..<14).map { ($0, $0 < 4 ? CPUCoreTopology.Kind.efficiency : .performance) }))
let widths = CPUCoreGrid.groupWidths(groups: m4, width: 185)
precondition(zip(m4, widths).map { CPUCoreGridLayout.rowCounts(count: $0.count, width: $1) } == [[4], [10]])
print("PASS: compact per-core meters with intact identities and bounded wrapping at multiple widths/counts")
}
}