From 77ecc8ddfe21bc4dfdcf477f58586236a99f1a3c Mon Sep 17 00:00:00 2001 From: cucadmuh <49571317+cucadmuh@users.noreply.github.com> Date: Sun, 31 May 2026 02:55:34 +0300 Subject: [PATCH] fix(perf): keep probe monitor metrics visible on Windows (#933) Stop replacing the whole Monitor tab when CPU/RSS sampling is unsupported; show pipeline, UI rate, and analysis sections with an inline platform note. Also compute UI diagRates when the Rust snapshot returns supported: false. --- .../perfProbe/SidebarPerfProbeMonitorTab.tsx | 17 +++--- src/utils/perf/perfLiveStore.ts | 58 ++++++++++--------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/src/components/sidebar/perfProbe/SidebarPerfProbeMonitorTab.tsx b/src/components/sidebar/perfProbe/SidebarPerfProbeMonitorTab.tsx index d0153fb6..aa3a799d 100644 --- a/src/components/sidebar/perfProbe/SidebarPerfProbeMonitorTab.tsx +++ b/src/components/sidebar/perfProbe/SidebarPerfProbeMonitorTab.tsx @@ -25,6 +25,7 @@ export default function SidebarPerfProbeMonitorTab() { const analysisPinned = usePipelineOverlayPinned('pipeline:analysis'); const coverPinned = usePipelineOverlayPinned('pipeline:cover'); const cpu = live.cpu; + const cpuSupported = cpu?.supported === true; const collecting = live.collecting && cpu == null; const includeThreadGroups = usePerfLiveIncludeThreadGroups(); const peakMemoryKbRef = useRef(1); @@ -51,14 +52,6 @@ export default function SidebarPerfProbeMonitorTab() { ); } - if (cpu && !cpu.supported) { - return ( -
- Live CPU/memory monitoring is unavailable on this platform or build. -
- ); - } - const toggleLive = (id: PerfLiveOverlayPinId) => () => togglePerfLiveOverlayPin(id); const livePinned = (id: PerfLiveOverlayPinId) => livePins.has(id); @@ -94,7 +87,13 @@ export default function SidebarPerfProbeMonitorTab() { /> - {cpu && ( + {cpu && !cpuSupported && ( +
+ Live CPU and RSS sampling is unavailable on this platform. Pipeline, UI rate, and analysis metrics below still work. +
+ )} + + {cpuSupported && cpu && ( <> { const generation = pollGeneration; const now = Date.now(); @@ -103,17 +126,16 @@ async function pollOnce(): Promise { const snap = await invoke('performance_cpu_snapshot', buildPerfCpuSnapshotRequest()); if (generation !== pollGeneration) return; + const nextCounters = readUiCounters(); + const diagRates = nextDiagRates(nextCounters, now); + prevCounters = nextCounters; + prevCountersAt = now; + if (!snap.supported) { setSnapshot({ cpu: { app: 0, webkit: 0, supported: false, memory: [], threadCpu: [] }, - diagRates: snapshot.diagRates, - analysis: { - tracksPerMinute: getAnalysisTracksPerMinute(), - lastTotalMs: snapshot.analysis?.lastTotalMs ?? null, - lastFetchMs: snapshot.analysis?.lastFetchMs ?? null, - lastSeedMs: snapshot.analysis?.lastSeedMs ?? null, - lastBpmMs: snapshot.analysis?.lastBpmMs ?? null, - }, + diagRates, + analysis: buildAnalysisDiag(), collecting: false, updatedAt: now, }); @@ -160,30 +182,12 @@ async function pollOnce(): Promise { } } - const nextCounters = readUiCounters(); - let diagRates = snapshot.diagRates; - if (prevCounters && prevCountersAt > 0) { - const dt = Math.max(0.25, (now - prevCountersAt) / 1000); - diagRates = { - progress: (nextCounters.progress - prevCounters.progress) / dt, - waveform: (nextCounters.waveform - prevCounters.waveform) / dt, - home: (nextCounters.home - prevCounters.home) / dt, - }; - } - prevCounters = nextCounters; - prevCountersAt = now; prevProc = snap; setSnapshot({ cpu, diagRates, - analysis: { - tracksPerMinute: getAnalysisTracksPerMinute(), - lastTotalMs: snapshot.analysis?.lastTotalMs ?? null, - lastFetchMs: snapshot.analysis?.lastFetchMs ?? null, - lastSeedMs: snapshot.analysis?.lastSeedMs ?? null, - lastBpmMs: snapshot.analysis?.lastBpmMs ?? null, - }, + analysis: buildAnalysisDiag(), collecting: false, updatedAt: now, });