---
# System prepended metadata

title: Performance & Profiling Unreal

---

# Useful

<a href="https://docs.unrealengine.com/5.2/en-US/stat-commands-in-unreal-engine/">Stat Group documentation.</a>
<a href="https://docs.unrealengine.com/5.2/en-US/gpudump-viewer-tool-in-unreal-engine/">GPU Dump.</a>
<a href="https://docs.unrealengine.com/5.2/en-US/low-latency-frame-syncing-in-unreal-engine/">Low-latency frame sync.</a>
<a href="https://www.cnblogs.com/kekec/p/17841097.html">Console Variables.</a>
<a href="https://docs.unrealengine.com/5.2/en-US/optimizing-rendering-with-pso-caches-in-unreal-engine/">PSO Caching.</a>
<a href="https://docs.unrealengine.com/5.2/en-US/parallel-rendering-overview-for-unreal-engine/">Difference between RenderingThread & RHIThread.</a>
<a href="https://docs.unrealengine.com/5.2/en-US/threaded-rendering-in-unreal-engine/">Threaded rendering UE.</a>

<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2932049745">Hogwarts Legacy: performance tweaks.</a>



# CPU or GPU bound ?

## Description

Based solely on the differents tick timings it is easy to figure out if the application is CPU or GPU bound.
In most cases, we want our application to be GPU bound which basically means that the application will be synchronized with GPU tick (as mentionned in [**GPU Synchronization**](#GPU-Synchronization)).

## Command
**Render time**: ```stat gpu```
**Game tick time**: ```stat game```

# GPU Pool Size

## Command

**See GPU streaming pool size**: ```r.Streaming.PoolSize```

## Default state

```r.Streaming.PoolSize = "1000"```

# RenderThread

## Command

**Watched infos in data generated by**: ```DumpGPU```

## Default state

![image](https://hackmd.io/_uploads/Skv3E_wr6.png)

# GPU Streaming

## Command

**Watched infos in data generated by**: ```DumpGPU```

## GPU Synchronization

## Description

Unreal uses multithreaded rendering which basically means that DrawCalls are not made from Gamethread.
Rendering is actually handled by 3 threads:
- GameThread:
	- Rendering resources.
  - Enqueues commands to RenderThread (see `ENQUEUE_UNIQUE_RENDER_COMMAND_XXXPARAMETER `).
  - Can block RenderThread (see `FlushRenderingCommands`).
- RenderThread:
	- Where the Compute|Render|Copy CommandLists are built.
  - Translates commands to the targeted graphics library.
- RHIThread
	- Executes CommandLists in the targeted graphics library.

 <img src="https://hackmd.io/_uploads/rJTH7YYwp.png" width=600></img>

 Here is and example of RenderThread and RHIThread execution.
  
More details <a href="https://docs.unrealengine.com/5.2/en-US/parallel-rendering-overview-for-unreal-engine/">here</a> and <a href="https://docs.unrealengine.com/5.2/en-US/threaded-rendering-in-unreal-engine/">here</a>.

**r.GTSyncType:**

![image](https://hackmd.io/_uploads/rJJ6UFPHT.png)

## Default state

![image](https://hackmd.io/_uploads/SJyAhtvS6.png)

## GPU Pool size
## Default state

![image](https://hackmd.io/_uploads/SJDinFDra.png)

# GPU Memory Footprint

## Command

**See GPU resources**: ```stat rhi```
**Get detailed report memory usage**: ```memreport -full```

## Tools
**Render Resource Viewer**:
![image](https://hackmd.io/_uploads/SkHUx3BIT.png)

# Analyzing framerate

 ## Command
 
 `CsvProfile start|stop`: Saves GPU|CPU timings to csv file. (In Project/Saved/Profiling)
 `StartFPSChart|StopFPSChart`: Logs GPU render timings to CSV file.
