skip to content

A game runs at 45 fps against a 60 Hz target; how do you tell whether the frame is CPU-bound or GPU-bound before optimising anything?

level: seniorimportance: must knowfreq 75%

answer

  1. the slower side sets the frame
  2. who waits for whom
  3. blocked in present is not work
  4. shrink the resolution, watch the time

basics

~20 s

Measure each side separately: CPU busy time per thread and GPU time per frame. The side busy for the whole 22 ms while the other waits is the bottleneck; confirm by changing only resolution or only CPU load.

solid answer

~50 s

At 45 fps the frame takes about 22.2 ms. Because the CPU prepares the next frame while the GPU draws the current one, frame time follows the slower side, so I measure both: instrumented busy time per CPU thread, with waits separated out, and GPU time from timestamp queries. If the GPU is busy for about 21 ms and the main thread works for 12 ms and then blocks in present, the frame is GPU-bound; if the main thread works for 21 ms and the GPU idles between frames, it is CPU-bound. Then I confirm with experiments: cut render resolution sharply, and a big drop means pixel-bound GPU work; skip simulation, and a drop means the CPU. The classic mistake is a naive main-thread frame timer that counts the wait in present as CPU work.

go deeper

for a junior

Recall that the CPU and GPU work in parallel and that the slower one sets the frame time.

for a middle

Explain how to read CPU busy time per thread and GPU time from timestamps, and why blocked time in present belongs to the GPU.

for a senior

Walk the diagnosis end to end: separate waits from work, run the resolution and CPU-load experiments, and name the cases that are neither, such as synchronisation stalls.

for a principal

Make the CPU and GPU split a standing report per scene and platform, so the team never spends weeks optimising the side that was not limiting.

## What "bound" means On most engines the CPU and the GPU work in parallel: while the GPU draws one frame, the CPU is already simulating and preparing the next. How many frames the CPU may run ahead, and the fences that limit it, belong with GPU submission. When the two overlap like this, **frame time is set by the slower side, not by the sum**: - **CPU-bound:** the CPU's critical thread needs longer than the GPU, so the GPU sits idle between frames waiting for work. - **GPU-bound:** the GPU needs longer, so the CPU finishes early and then blocks, typically inside the call that presents the frame or acquires the next back buffer, until the GPU frees one. Optimising the side that is not limiting leaves frame time where it was. That is why the diagnosis comes before any optimisation. ## Read both timelines For a game at 45 fps, about 22.2 ms per frame, against a 16.7 ms target: - **CPU busy time per thread** from instrumented zones (main thread, render thread, workers), with time spent **waiting** separated from time spent **working**. - **GPU time per frame and per pass** from timestamp queries. - **Compare:** if the GPU is busy for about 21 ms while the main thread works for 12 ms and waits for the rest, the frame is GPU-bound. If the main thread works for 21 ms and the GPU is busy for 10 ms with gaps between frames, it is CPU-bound. Measure with vsync off, or read the busy times directly: with vsync on, both sides also wait for the display, and frame time alone stops telling you which side is slow. ## Experiments that isolate the side 1. **Cut render resolution sharply**, for example to a quarter of the pixels. If frame time falls a lot, the GPU was limited by work that scales with pixels. If nothing changes, the frame is not pixel-bound, but the GPU may still be limited by geometry, compute or a fixed-cost pass, so confirm with GPU timestamps. 2. **Remove CPU work** without touching rendering: skip the AI update, freeze the simulation or render a static scene. If frame time falls, the CPU was on the critical path. 3. **Check per thread, not total CPU usage.** A game can be CPU-bound on its main or render thread while total CPU usage across all cores reads 30 %. ## The wait-time trap The most common misdiagnosis comes from a naive frame timer on the main thread. It measures from the start of one frame to the start of the next, so time spent blocked waiting for the GPU is counted as main-thread time. The main thread then appears to take 22 ms, everyone concludes the game is CPU-bound, and weeks of CPU optimisation change nothing. The fix is to put a zone around the wait itself and read it separately: blocked time in present or buffer acquisition is the GPU's time showing through on the CPU. ## Cases that are neither, or both - **Synchronisation stalls:** the CPU reads back a GPU result in the same frame, so each side waits for the other and both timelines show idle gaps. - **Different bottlenecks in different scenes:** a menu can be CPU-bound and a dense battle GPU-bound; diagnose the scene that breaks the budget. - **Thermal throttling** on handheld and mobile hardware moves the bottleneck over minutes of play. - **Balanced frames:** when both sides sit near the budget, a win on one side alone buys little, and both need cuts. ## Summary of symptoms | Observation | Points to | |---|---| | CPU blocked in present or buffer acquisition, GPU busy wall to wall | GPU-bound | | GPU idle between frames, one CPU thread busy the whole frame | CPU-bound on that thread | | Lower resolution cuts frame time a lot | GPU-bound on pixel work | | Lower resolution changes nothing and GPU time is small | CPU-bound | | Idle gaps on both sides | A synchronisation stall |

  • Cutting render resolution to a quarter changes nothing. Is the game therefore CPU-bound?
    Not proven. It shows the frame is not limited by pixel work, but the GPU could still be limited by geometry, compute or a pass whose cost does not scale with resolution. Check GPU timestamps: if GPU time is well below frame time and one CPU thread is busy for the whole frame, it is CPU-bound.
  • The main thread shows 21 ms per frame, but 9 ms of it is inside the call that presents the frame. What does that mean?
    Those 9 ms are waiting, not work: the CPU is blocked until the GPU frees a buffer, so the GPU is the slower side. The main thread's real work is about 12 ms. Optimising main-thread code would not move frame time; the GPU's passes need the cuts.
  • Can a game be CPU-bound while most of its cores sit idle?
    Yes. Frame time follows the critical thread, so one main or render thread busy for the whole frame limits the game even if total CPU usage is low. Read per-thread timelines; the cure is shortening that thread's work or moving work off it.

A sandwich counter has an order-taker and a cook. If the cook is busy nonstop while the order-taker stands waiting at the pass, a faster order-taker serves no more customers; you need a faster cook. The side that waits is not the bottleneck.

  • Low total CPU usage proves the game is GPU-bound.
  • Time spent inside the present call is CPU work to optimise.
  • If lower resolution does not help, the GPU cannot be the bottleneck.
  • Frame time is CPU time plus GPU time.
  • Optimising either side always raises the frame rate.