feat(monitors): 实现 CPU 内存采样诊断与菜单栏实时指标

接入 Mach CPU 差分、内存与负载采样、暂停恢复及按需诊断,合并菜单栏单一原生标题的显示修复。
保留核心检查和本机交互验收记录;长期资源预算仍待验收。
This commit is contained in:
2026-10-30 00:45:34 +08:00
parent 42791b2ee7
commit 631b412d15
19 changed files with 483 additions and 36 deletions
+9 -3
View File
@@ -7,14 +7,20 @@
import SwiftUI
/// 菜单栏弹出面板:后续将在这里展示 CPU / 内存 / 磁盘 / 网络等实时监控数据。
/// A 阶段临时面板:展示采样时间与暂停入口,正式面板在 B 阶段实现。
struct MenuPanelView: View {
let metrics: MetricsStore
var body: some View {
VStack(alignment: .leading, spacing: 12) {
Label("Kymo 资源监控", systemImage: "gauge")
.font(.headline)
Text("监控面板开发中,敬请期待…")
Text(metrics.snapshot.date, style: .time)
Button(metrics.isPaused ? "继续监控" : "暂停监控") {
metrics.togglePause()
}
Text("GPU 暂不可用")
.font(.subheadline)
.foregroundStyle(.secondary)
}
@@ -24,5 +30,5 @@ struct MenuPanelView: View {
}
#Preview {
MenuPanelView()
MenuPanelView(metrics: MetricsStore())
}