mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
feat(perf): add on-demand (ui) throughput to cover pipeline cpm (#947)
* feat(perf): add on-demand (ui) throughput to cover pipeline cpm Cover cpm previously measured only the native backfill (lib) via the cover:library-progress done delta. Add a parallel UI series: every completed on-demand Rust cover ensure (grid / now-playing) records a timestamp, surfaced as a covers-per-minute rate. Both are exposed in the live cover diag, shown as separate Backfill (lib) / On-demand (ui) cards in the Monitor tab (each pinnable to the overlay) and as lib/ui rows in the Cover pipeline overlay block. * docs(changelog): note cover on-demand (ui) throughput (PR #947) Add CHANGELOG entry and credits line for the UI cover cpm metric. * fix(perf): source on-demand (ui) cpm from backend produced-cover count The JS ensure-queue counter never tracked: produced covers return hit:true (only misses/errors are hit:false), and ensure-queue dedup/HMR made client counting unreliable. Count on-demand covers natively in ensure_inner on the produce path (non-bulk, past the cache-hit gate), expose a cumulative uiEnsuredTotal in the pipeline stats, and derive the per-minute rate on the frontend from polled deltas — mirroring the lib backfill series. * perf(cover): measure cpm over trailing 5s instead of full minute A 60s rolling average added too much inertia, flattening real bursts and stalls in both the lib backfill and on-demand (ui) cover throughput. Compute the rate from the trailing 5s of samples (still extrapolated to per-minute), so the figure reacts promptly and decays to 0 within the window when idle.
This commit is contained in:
@@ -32,7 +32,7 @@ import {
|
||||
} from '../utils/perf/perfOverlayMode';
|
||||
import { useAnalysisPerfListener } from '../hooks/useAnalysisPerfListener';
|
||||
import { useCoverPerfListener } from '../hooks/useCoverPerfListener';
|
||||
import { getCoverCachedPerMinute } from '../utils/perf/coverPerfStore';
|
||||
import { getCoverCachedPerMinute, getCoverUiPerMinute } from '../utils/perf/coverPerfStore';
|
||||
|
||||
const SAMPLE_MS = 500;
|
||||
const TPM_REFRESH_MS = 500;
|
||||
@@ -69,6 +69,7 @@ export default function FpsOverlay() {
|
||||
const [fps, setFps] = useState(0);
|
||||
const [tpm, setTpm] = useState(0);
|
||||
const [cpm, setCpm] = useState(0);
|
||||
const [cpmUi, setCpmUi] = useState(0);
|
||||
const [queueStats, setQueueStats] = useState<AnalysisPipelineQueueStatsDto | null>(null);
|
||||
const [coverQueueLines, setCoverQueueLines] = useState<string[]>([]);
|
||||
const last = useAnalysisPerfLast();
|
||||
@@ -135,9 +136,13 @@ export default function FpsOverlay() {
|
||||
useEffect(() => {
|
||||
if (!showCoverPerfOverlay) {
|
||||
setCpm(0);
|
||||
setCpmUi(0);
|
||||
return;
|
||||
}
|
||||
const refresh = () => setCpm(getCoverCachedPerMinute());
|
||||
const refresh = () => {
|
||||
setCpm(getCoverCachedPerMinute());
|
||||
setCpmUi(getCoverUiPerMinute());
|
||||
};
|
||||
refresh();
|
||||
const id = window.setInterval(refresh, TPM_REFRESH_MS);
|
||||
return () => window.clearInterval(id);
|
||||
@@ -270,7 +275,12 @@ export default function FpsOverlay() {
|
||||
<div className="fps-overlay__row">
|
||||
{cpm.toFixed(1)}
|
||||
{' '}
|
||||
<span className="fps-overlay__unit">cpm</span>
|
||||
<span className="fps-overlay__unit">lib cpm</span>
|
||||
</div>
|
||||
<div className="fps-overlay__row">
|
||||
{cpmUi.toFixed(1)}
|
||||
{' '}
|
||||
<span className="fps-overlay__unit">ui cpm</span>
|
||||
</div>
|
||||
{coverQueueLines.length > 0 ? coverQueueLines.map(line => (
|
||||
<div key={line} className="fps-overlay__row fps-overlay__row--steps">
|
||||
|
||||
@@ -223,9 +223,9 @@ export default function SidebarPerfProbeMonitorTab() {
|
||||
)}
|
||||
|
||||
{live.cover && (
|
||||
<PerfProbeMetricSection title="Cover backfill" defaultOpen={false}>
|
||||
<PerfProbeMetricSection title="Cover pipeline" defaultOpen={false}>
|
||||
<PerfProbeMetricCard
|
||||
label="Throughput"
|
||||
label="Backfill (lib)"
|
||||
value={live.cover.cachedPerMinute.toFixed(1)}
|
||||
unit="cpm"
|
||||
detail={live.cover.total > 0
|
||||
@@ -234,6 +234,14 @@ export default function SidebarPerfProbeMonitorTab() {
|
||||
pinned={livePinned('cover:cpm')}
|
||||
onTogglePin={toggleLive('cover:cpm')}
|
||||
/>
|
||||
<PerfProbeMetricCard
|
||||
label="On-demand (ui)"
|
||||
value={live.cover.uiPerMinute.toFixed(1)}
|
||||
unit="cpm"
|
||||
detail="UI cover ensures per minute"
|
||||
pinned={livePinned('cover:cpm:ui')}
|
||||
onTogglePin={toggleLive('cover:cpm:ui')}
|
||||
/>
|
||||
</PerfProbeMetricSection>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user