Course contentsShow
← Unreal Engine Game Development
Lesson 768 of 88011. Performance Profiling and OptimizationFree lesson

Navigating Real-Time Stat Commands

You will master the use of console commands like stat unit and stat fps to diagnose immediate bottlenecks in CPU and GPU processing.

In this lesson, you will learn how to leverage real-time console commands to instantly pinpoint whether your performance bottlenecks are occurring on the CPU or the GPU.

When a scene begins to stutter, the first step in your diagnostic pipeline is to look past the frame rate and analyze the underlying workload. To do this, open the console (tilde ~ key) and type stat unit. This command displays four key metrics at the top right of your viewport: Frame, Game, Draw, and GPU.

Decoding the Unit Stats

  • Frame: The total time taken to complete one full frame.
  • Game: The time the CPU spends on the Game Thread (handling logic, AI, and movement).
  • Draw: The time the CPU spends on the Render Thread (preparing commands for the GPU).
  • GPU: The time taken by the graphics hardware to finish rendering the frame.

If you see Frame and Game spikes, your gameplay logic or complex blueprint logic is likely the culprit. If Draw is high, you are likely hitting an object-count bottleneck, such as too many draw calls. If GPU is the highest value, your shaders, complex materials, or high-density meshes are likely overworking the graphics card.

Complementing with stat fps

While stat unit provides the deep dive, stat fps is your quick-look tool. It displays your current frames per second and the frame time in milliseconds. When performance dips, toggling stat fps allows you to see if the frame rate drop is consistent (perhaps a shader issue) or erratic (perhaps a specific logic event triggering a spike).

To clear these from your screen once you have diagnosed the issue, simply type the command again or use stat none to clear all active stats. By monitoring these during gameplay, you move away from guessing and toward data-driven optimization of your game's engine throughput.

Key Takeaway: Use stat unit to identify if your bottleneck is on the Game Thread, Draw Thread, or GPU, allowing you to prioritize your optimization efforts where they will yield the greatest frame-time improvements.