[Performance/Engine] Frame pacing spikes on 64 Hz server ticks caused by synchronous Fork-Join barrier in scenesystem.dll
Your system information:
https://gist.github.com/1337Shameless/73844b763f3b6e9865dc68726cec9754
Please describe your issue in as much detail as possible:
During active gameplay, the engine exhibits periodic frame pacing degradation and severe frametime spikes that repeat precisely every 15.6 ms (the 1/64 s server tick interval). Low-level profiling across Intel PresentMon, Superluminal, and Windows Performance Analyzer (WPA) reveals that these stalls are caused by a synchronous Fork-Join barrier where the Main Thread enters a kernel wait state, halting execution and starving the GPU command queue.
1. PresentMon Telemetry: 15.6 ms Tick-Aligned GPU Starvation
Capturing frametimes with Intel PresentMon isolates clockwork latency spikes aligned with incoming server packets:
MsGPUBusyremains completely flat at ~1.2 ms, confirming the GPU has plenty of headroom and is not encountering shading or geometry bottlenecks.MsGPUWaitmirrors the frametime spikes with an $r = 0.83$ correlation, indicating that over 80% of the frametime hitching is caused by the GPU sitting completely idle, waiting for the CPU to submit work.- Every 15.6 ms, incoming server tick data halts render submission, driving instantaneous frametimes into sharp repeating peaks.
2. Superluminal Profiler: Synchronous Barrier & Tail Latency
Profiling thread interaction in Superluminal during these frame pacing spikes shows the exact bottleneck inside scenesystem.dll and tier0.dll:
- Main Thread Suspension:
MainThrdenters stateSynchronizationand remains blocked inside the Windows kernel. - Frame Budget Depletion: On high-end configurations targeting 300+ FPS, the target frame budget is $\le 3.33\text{ ms}$. A kernel stall consumes over 90% to 100% of the entire frame budget on a single synchronous wait before any draw submission can occur.
- Worker Dependency (Straggler Effect):
MainThrdis held hostage waiting for individual worker threads insideGlobPoolto complete and signal.
3. WPA ETW Analysis: Excessive Context Switching Friction
Analyzing precise CPU usage and context switches (KiSwapContext) in Windows Performance Analyzer highlights massive scheduler overhead across the 15 worker threads (GlobPool/0 to GlobPool/14):
- Severe Switch Rates: Over 1,234,900 context switches recorded within a 14.77-second trace—amounting to over 83,500 context switches per second.
- Frequent Kernel Sleeps: Worker threads average ~4,770 wakeups/sec, with 96% of switch-ins originating from blocking kernel waits. Workers execute short compute slices (~50 µs) followed by kernel waits (~150 µs).
- Scheduler Queue Latency: Worker threads exhibit scheduling
Readyqueue spikes of up to 1,100–1,127 µs (~1.13 ms). Because the Main Thread waits synchronously onWaitForMultipleObjects, any OS scheduling delay or compute variance on the slowest worker directly translates into an immediate frame stall on the Main Thread.
Describe what you expected should happen and what did happen:
- Expected behavior: On a high-end system frame delivery should remain smooth and consistent, with render submission decoupled from background tick simulation so that incoming server packets do not stall the presentation thread.
- Actual behavior: Incoming 64 Hz tick packets trigger a synchronous Fork-Join barrier. The Main Thread halts execution via
WaitForMultipleObjectsawaitingGlobPoolworkers, exhausting the frame budget, starving the GPU (MsGPUWaitspike), and causing severe micro-stutter and input inconsistency.
Steps for reproducing this issue:
- Launch Counter-Strike 2 and join any 64-tick server (official matchmaking or casual).
- Attach Intel PresentMon and record frame metrics (
MsGPUBusy,MsGPUWait,Frametime) during active engagements. Observe cyclical frametime spikes matching the 15.6 ms tick period alongside correlatedMsGPUWaitjumps. - Attach Superluminal or capture an ETW kernel trace using Windows Performance Recorder (WPR) with Context Switch and CPU sampling enabled.
- Inspect
MainThrdexecution: filter by stateSynchronization. - Verify the blocking callstack halting on
ZwWaitForMultipleObjectsand observe the duration until unblocked byGlobPoolworkers executingSetEvent.