perf(efficiency): 接入真实CPU能量并隔离展示与采样需求
This commit is contained in:
@@ -52,20 +52,7 @@ extension MenuPanelView {
|
||||
}.font(PanelStyle.label)
|
||||
.modifier(CardInset())
|
||||
}
|
||||
.task(id: "\(publicIPRoute):\(metrics.isPaused)") {
|
||||
guard !metrics.isPaused, metrics.isPanelVisible else { return }
|
||||
publicIPAddress = nil
|
||||
guard snapshot.networkPath == .available else { return }
|
||||
await PublicIPAddressService.shared.refreshContinuously(route: publicIPRoute) { address in
|
||||
await MainActor.run {
|
||||
guard !Task.isCancelled else { return }
|
||||
publicIPAddress = address
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var publicIPRoute: String {
|
||||
"\(snapshot.defaultNetworkInterface ?? ""):\(String(describing: snapshot.networkPath)):\(snapshot.network?.filter { $0.active }.map { $0.addresses.joined(separator: ",") }.joined(separator: ";") ?? "")"
|
||||
.modifier(PanelPublicIPRefresh(metrics: metrics, address: $publicIPAddress))
|
||||
}
|
||||
func networkAddress(_ title: LocalizedStringKey, address: String?) -> some View {
|
||||
HStack(spacing: 4) {
|
||||
|
||||
Reference in New Issue
Block a user