r.ProfileGPU.PrintAssetSummary

r.ProfileGPU.PrintAssetSummary

#Overview

name: r.ProfileGPU.PrintAssetSummary

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.ProfileGPU.PrintAssetSummary is to control whether a summary of GPU profiling data should be printed, specifically split by asset. This setting is part of Unreal Engine’s GPU profiling and performance analysis system.

This setting variable is primarily used in the RHI (Rendering Hardware Interface) module of Unreal Engine, as evidenced by its location in the GPUProfiler.cpp file within the RHI source directory.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as a TAutoConsoleVariable with an initial value of 0 (disabled by default) and can be changed at runtime.

This variable interacts closely with another variable, GProfilePrintAssetSummary. They share the same value and are used interchangeably in the code.

Developers should be aware that:

  1. This setting is particularly useful when used in conjunction with r.ShowMaterialDrawEvents, as mentioned in the comment.
  2. Enabling this option may have a performance impact, as it requires additional data gathering during GPU profiling.
  3. The summary is only printed when GPU profiling is active.

Best practices when using this variable include:

  1. Enable it only when needed for performance analysis, as it may impact runtime performance.
  2. Use it in combination with r.ShowMaterialDrawEvents for more comprehensive asset-based profiling.
  3. Be prepared to analyze the resulting asset summary to identify performance bottlenecks related to specific assets.

Regarding the associated variable GProfilePrintAssetSummary:

The purpose of GProfilePrintAssetSummary is to serve as the internal representation of the r.ProfileGPU.PrintAssetSummary console variable. It’s used within the C++ code to check the current state of the setting.

This variable is used in the RHI module, specifically within the GPU profiler functionality.

Its value is set by the TAutoConsoleVariable system when r.ProfileGPU.PrintAssetSummary is modified.

GProfilePrintAssetSummary interacts directly with r.ProfileGPU.PrintAssetSummary, as they represent the same setting.

Developers should be aware that this variable is accessed using the GetValueOnRenderThread() method, ensuring thread-safe access to its value.

Best practices for using GProfilePrintAssetSummary include:

  1. Always access it using GetValueOnRenderThread() when in render thread code.
  2. Avoid directly modifying this variable; instead, use the console variable system to change r.ProfileGPU.PrintAssetSummary.
  3. Consider caching the value if it’s accessed frequently in performance-critical code paths to avoid repeated calls to GetValueOnRenderThread().

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:59

Scope: file

Source code excerpt:

// Should we print a summary at the end?
static TAutoConsoleVariable<int32> GProfilePrintAssetSummary(
	TEXT("r.ProfileGPU.PrintAssetSummary"),
	0,
	TEXT("Should we print a summary split by asset (r.ShowMaterialDrawEvents is strongly recommended as well).\n"),
	ECVF_Default);

// Should we print a summary at the end?
static TAutoConsoleVariable<FString> GProfileAssetSummaryCallOuts(

#Associated Variable and Callsites

This variable is associated with another variable named GProfilePrintAssetSummary. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:58

Scope: file

Source code excerpt:


// Should we print a summary at the end?
static TAutoConsoleVariable<int32> GProfilePrintAssetSummary(
	TEXT("r.ProfileGPU.PrintAssetSummary"),
	0,
	TEXT("Should we print a summary split by asset (r.ShowMaterialDrawEvents is strongly recommended as well).\n"),
	ECVF_Default);

// Should we print a summary at the end?

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:200

Scope (from outer to inner):

file
function     FGPUProfileStatSummary

Source code excerpt:

	{
		bDumpEventLeafNodes = GProfileGPUShowEvents.GetValueOnRenderThread() != 0;
		bGatherSummaryStats = GProfilePrintAssetSummary.GetValueOnRenderThread() != 0;
	}

	void ProcessMatch(FGPUProfilerEventNode* Node)
	{
		if (bGatherSummaryStats && (Node->NumTotalPrimitives > 0) && (Node->NumTotalVertices > 0) && (Node->Children.Num() == 0))
		{