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
@@ -39,7 +39,7 @@ extension MenuPanelView {
second: samples.map(\.cpuUser), third: samples.map(\.cpuSystem),
color: Color("MetricCPU"), secondColor: Color("SeriesUser"), thirdColor: Color("SeriesSystem"),
firstLabel: "gpu.totalUtilization", secondLabel: "cpu.user", thirdLabel: "cpu.system", expectedInterval: chartInterval,
boundaryDates: chartBoundaries, intervals: chartIntervals)
boundaryDates: chartBoundaries, intervals: chartIntervals, stackOrder: [2, 1])
}
) {
HStack(spacing: 5) {
@@ -64,10 +64,12 @@ extension MenuPanelView {
chart: {
PanelTrendChart(
dates: samples.map(\.date), first: samples.map(\.gpu),
second: samples.map(\.gpuRenderer), third: samples.map(\.gpuTiler),
color: Color("MetricGPU"), secondColor: Color("MetricCPU"), thirdColor: Color("SeriesSystem"),
firstLabel: "gpu.totalUtilization", secondLabel: "gpu.renderer", thirdLabel: "gpu.tiler",
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
second: samples.map { $0.gpu.map { max(0, 1 - $0) } },
third: samples.map(\.gpuRenderer), fourth: samples.map(\.gpuTiler),
color: Color("MetricGPU"), secondColor: Color("MemoryAvailable"),
thirdColor: Color("MetricCPU"), fourthColor: Color("SeriesSystem"),
firstLabel: "gpu.totalUtilization", secondLabel: "gpu.idle", thirdLabel: "gpu.renderer", fourthLabel: "gpu.tiler",
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals, stackOrder: [0, 1])
}
) {
HStack(spacing: 5) {
@@ -75,8 +77,6 @@ extension MenuPanelView {
Text(verbatim: String(format: AppLocalization.string("gpu.coreCountFormat", locale: locale), count))
.foregroundStyle(.secondary)
}
inlineMetric("gpu.renderer", MetricFormat.percent(snapshot.gpu?.renderer))
inlineMetric("gpu.tiler", MetricFormat.percent(snapshot.gpu?.tiler))
}.font(.system(size: 9)).lineLimit(1).minimumScaleFactor(0.75).frame(height: 12)
let fans = displayedFans
if !fans.isEmpty {
@@ -85,7 +85,8 @@ extension MenuPanelView {
FanSpeedIndicator(
title: fans.count == 2
? (fan.id == 0 ? Text("gpu.fanLeft") : Text("gpu.fanRight"))
: Text("gpu.fanNumber \(fan.id + 1)"), rpm: fan.rpm)
: Text("gpu.fanNumber \(fan.id + 1)"), rpm: fan.rpm,
isActive: metrics.isPanelVisible && !metrics.isPaused && !metrics.isSystemSleeping && !metrics.isDisplaySleeping)
.frame(height: 12)
}
}
@@ -114,7 +115,7 @@ extension MenuPanelView {
thirdColor: Color("MemoryWired"), fourthColor: Color("MemoryCompressed"), fixedScale: Double(snapshot.memory?.total ?? 1),
firstValueFormat: .memory, firstLabel: "gpu.totalUtilization",
secondLabel: "memory.app", thirdLabel: "memory.wired", fourthLabel: "memory.compressed",
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals, stackOrder: [1, 2, 3])
}
) {
if let memory = snapshot.memory {