Intel® VTune™ Profiler Performance Analysis Cookbook

ID 766316
Date 9/05/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Profiling Games built with Unreal Engine* (NEW)

Use this recipe to profile a game built with Unreal Engine. See how you can run Intel® VTune™ Profiler within the Unreal Engine environment to profile your game.

Often, the most important factor that affects the performance of a game is the frame rate. This is the speed with which the GPU renders game graphics. However, the CPU can also impact game performance in several ways:

  • Slow transfer of data to the GPU
  • Slow or unnecessary operations
  • Poor parallelism
With games that use the Unreal Engine (UE), much of the optimization takes place in the Unreal editor. Therefore, it is critical to understand the performance of Unreal Engine-defined tasks. The 4.19 and newer versions of Unreal Engine have the Intel® VTune™ Profiler Instrumentation and Tracing Technology (ITT) API built into the Unreal editor. This recipe demonstrates how you can run VTune Profiler to highlight UE tasks in the editor.

Ingredients

Here are the hardware and software requirements for this performance recipe.

  • Application: Unreal Engine 4.25.4. The sample game in this version of Unreal Engine is the Action RPG tutorial.

  • Tools: Intel® VTune™ Profiler version 2022 - Hotspots Analysis (using User-Mode Sampling)

    NOTE:
    • Starting with the 2020 release, Intel® VTune™ Amplifier has been renamed to Intel® VTune™ Profiler.

    • Most recipes in the Intel® VTune™ Profiler Performance Analysis Cookbook are flexible. You can apply them to different versions of Intel® VTune™ Profiler. In some cases, minor adjustments may be required.

    • Get the latest version of Intel® VTune™ Profiler:

  • CPU/GPU: 11th Generation Intel® Core™ i7-1165G7 CPU @ 2.80GHz with Intel® Iris® Xe MAX Graphics

  • Operating system: Windows* 11 Enterprise

Build the Game in the Unreal Editor

  1. Open the game in the Unreal editor.

  2. Build the game. Make sure to select the Development Build Configuration and Include Debug Files options.

Configure Intel® VTune™ Profiler and Run Hotspots Analysis

  1. Open Intel® VTune™ Profiler and click New Project on the Welcome screen.

  2. Specify a project name and a location for your project.

  3. Click Create Project.
  4. In the Configure Analysis window, set these options:
    • In the WHERE pane, select Local Host.

    • In the Application field of the WHAT pane, enter the path to the game executable.

    • In the Application parameters field, enter -VTune.

  5. (Optional) If you want to skip profiling the start/loading phase of the game,
    • In the WHAT pane, open the Advanced section.
    • Set
    • Under Limit collected data by, set a value in seconds for Time from collection end, sec. This is the duration (in seconds) before the end of the collection for which Intel® VTune™ Profiler should retain the results. The data collected earlier than this time gets discarded.
  6. In the HOW pane, select the Hotspots analysis type and enable user-mode sampling.

  7. Click Start to run the analysis.

NOTE:
If you set the Automatically resume collection after option in step 5, only the Start Paused button ( ) is available.

Review Results

When the data collection stops, Intel® VTune™ Profiler finalizes the results. This process may take a few minutes as Intel® VTune™ Profiler finds and resolves debug symbols.

Once results have been finalized, the Summary tab displays information about:

  • Elapsed time
  • Top hotspots
  • Top Unreal Engine tasks
  • Additional insights and guidance

Switch to the Bottom-up window to see a list of functions. The default sorting is by descending order of CPU time.

Change the grouping from Function / Call Stack to Task Domain / Task Type / Function / Call Stack to focus on Unreal Engine tasks which were identified by the Intel® VTune™ Profiler Instrumentation and Tracing Technology API (ITT API).

In this example, there is considerable spin time in the Render and Game threads. Also, nearly half of the overall CPU utilization was spent spinning, or waiting for a resource to return.

The CPU utilization histogram (in the Summary tab) tells us something important. Although this game was running over 100 threads, for the majority of the run, this game only utilized a single CPU or was mostly idle.

From here, you can try to identify whether the high amount of spin is affecting performance negatively. You can also examine how to make use of more CPU capability. Generally games are not expected to consume the full amount of hardware resources, but there is room on this system for more parallelism.

For additional insights into hotspots, open the Flame Graph view to see a graphical representation of call stacks from the top down.