r.ProfileGPU.ShowEventHistogram

r.ProfileGPU.ShowEventHistogram

#Overview

name: r.ProfileGPU.ShowEventHistogram

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.ShowEventHistogram is to control whether the GPU event histogram should be displayed in the GPU profiler output. This setting is primarily used for performance analysis and debugging of GPU-related tasks in Unreal Engine.

This setting variable is used in the RHI (Rendering Hardware Interface) module of Unreal Engine, specifically in the GPU profiler subsystem. The RHI module is responsible for abstracting the low-level graphics API calls and providing a unified interface for the engine’s rendering systems.

The value of this variable is set through the Unreal Engine console or configuration files. It is defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands.

The associated variable GProfileShowEventHistogram interacts directly with r.ProfileGPU.ShowEventHistogram. They share the same value and purpose.

Developers should be aware that enabling this variable may have a performance impact, as it requires additional processing to generate and display the histogram. It should primarily be used for debugging and profiling purposes, not in shipping builds.

Best practices when using this variable include:

  1. Use it in conjunction with other GPU profiling tools for a comprehensive performance analysis.
  2. Enable it only when needed for performance investigation.
  3. Be mindful of the potential performance overhead when enabled.
  4. Use it in development and testing environments rather than in production.

Regarding the associated variable GProfileShowEventHistogram:

The purpose of GProfileShowEventHistogram is identical to r.ProfileGPU.ShowEventHistogram. It is an internal representation of the console variable within the C++ code.

This variable is used directly in the GPU profiler code to determine whether to display the event histogram. It’s accessed using the GetValueOnRenderThread() method, which ensures thread-safe access to the variable’s value.

Developers should be aware that this variable is intended for internal use within the engine’s GPU profiler implementation. They should interact with the r.ProfileGPU.ShowEventHistogram console variable rather than directly manipulating GProfileShowEventHistogram.

Best practices for GProfileShowEventHistogram are the same as those for r.ProfileGPU.ShowEventHistogram, as they represent the same setting. Developers should rely on the console variable interface for changing this setting rather than attempting to modify the GProfileShowEventHistogram directly in code.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> GProfileShowEventHistogram(
	TEXT("r.ProfileGPU.ShowEventHistogram"),
	0,
	TEXT("Whether the event histogram should be shown."),
	ECVF_Default);

static TAutoConsoleVariable<int32> GProfileGPUShowEvents(
	TEXT("r.ProfileGPU.ShowLeafEvents"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> GProfileShowEventHistogram(
	TEXT("r.ProfileGPU.ShowEventHistogram"),
	0,
	TEXT("Whether the event histogram should be shown."),
	ECVF_Default);

static TAutoConsoleVariable<int32> GProfileGPUShowEvents(

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

Scope (from outer to inner):

file
function     void FGPUProfilerEventNodeFrame::DumpEventTree

Source code excerpt:

		Summary.PrintSummary();

		const bool bShowHistogram = GProfileShowEventHistogram.GetValueOnRenderThread() != 0;

		if (RootWildcardString == TEXT("*") && bShowHistogram)
		{
			// Sort descending based on node duration
			EventHistogram.ValueSort( FNodeStatsCompare() );