perf(efficiency): 接入真实CPU能量并隔离展示与采样需求
This commit is contained in:
@@ -54,8 +54,8 @@ struct MenuPanelView: View {
|
||||
} else {
|
||||
resourceRows
|
||||
}
|
||||
if metrics.isPanelVisible && PanelResourceAudit.omitted != "processes" {
|
||||
ProcessTableView(snapshot: snapshot.processes, wide: panelSize.width >= 900).frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
if presentation.isOpen && PanelResourceAudit.omitted != "processes" {
|
||||
PanelProcessSection(metrics: metrics, wide: panelSize.width >= 900).frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.frame(minHeight: 170)
|
||||
}
|
||||
}
|
||||
@@ -65,13 +65,11 @@ struct MenuPanelView: View {
|
||||
if panelSize != size { panelSize = size }
|
||||
}.frame(width: 0, height: 0))
|
||||
.onAppear {
|
||||
metrics.setPanelVisible(true)
|
||||
reservedFanCount = snapshot.fans?.count ?? 0
|
||||
}
|
||||
.onChange(of: snapshot.fans?.count) { _, count in
|
||||
reservedFanCount = max(reservedFanCount, count ?? 0)
|
||||
}
|
||||
.onDisappear { metrics.setPanelVisible(false) }
|
||||
.onChange(of: snapshot.network?.map(\.identity)) { _, keys in
|
||||
if !selectedInterface.isEmpty && !(keys ?? []).contains(selectedInterface) { selectedInterface = "" }
|
||||
}
|
||||
@@ -215,3 +213,10 @@ private struct PanelControlButtonBody<Content: View>: View {
|
||||
.onHover { isHovered = $0 }
|
||||
}
|
||||
}
|
||||
|
||||
/// Keep process publications out of the resource-card observation scope.
|
||||
private struct PanelProcessSection: View {
|
||||
let metrics: MetricsStore
|
||||
let wide: Bool
|
||||
var body: some View { ProcessTableView(snapshot: metrics.processSnapshot, wide: wide) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user