r.ProfileGPU.ThresholdPercent
r.ProfileGPU.ThresholdPercent
#Overview
name: r.ProfileGPU.ThresholdPercent
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Percent of the total execution duration the event needs to be larger than to be printed.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ProfileGPU.ThresholdPercent is to set a threshold for GPU profiling events in Unreal Engine 5. It determines which events are significant enough to be printed in the GPU profiler output based on their execution duration relative to the total frame time.
This setting variable is primarily used by the GPU profiling system, which is part of the RHI (Rendering Hardware Interface) module in Unreal Engine 5. 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 as a console variable, which means it can be adjusted at runtime through the console or configuration files. It’s initialized with a default value of 0.0f, meaning all events will be printed by default.
The associated variable GProfileThresholdPercent interacts directly with r.ProfileGPU.ThresholdPercent. It’s used to access the value of the console variable in the C++ code.
Developers should be aware that:
- This variable affects the verbosity of GPU profiling output. A higher threshold will result in fewer events being printed, focusing on the most time-consuming operations.
- Setting the threshold too high might cause important but shorter events to be omitted from the output.
- The threshold is applied as a percentage of the total frame time, not an absolute duration.
Best practices when using this variable include:
- Start with a low threshold (or 0.0f) to get a complete picture of GPU operations.
- Gradually increase the threshold to focus on the most significant bottlenecks.
- Use in conjunction with other profiling tools and variables for a comprehensive performance analysis.
- Adjust the threshold based on the specific needs of your project and the performance issues you’re investigating.
Regarding the associated variable GProfileThresholdPercent:
This is an internal variable used to access the value of r.ProfileGPU.ThresholdPercent within the C++ code. It’s defined as a TAutoConsoleVariable
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:34
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> GProfileThresholdPercent(
TEXT("r.ProfileGPU.ThresholdPercent"),
0.0f,
TEXT("Percent of the total execution duration the event needs to be larger than to be printed."),
ECVF_Default);
static TAutoConsoleVariable<int32> GProfileShowEventHistogram(
TEXT("r.ProfileGPU.ShowEventHistogram"),
#Associated Variable and Callsites
This variable is associated with another variable named GProfileThresholdPercent
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:33
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<float> GProfileThresholdPercent(
TEXT("r.ProfileGPU.ThresholdPercent"),
0.0f,
TEXT("Percent of the total execution duration the event needs to be larger than to be printed."),
ECVF_Default);
static TAutoConsoleVariable<int32> GProfileShowEventHistogram(
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:295
Scope (from outer to inner):
file
function static void DumpStatsEventNode
Source code excerpt:
// Percent that this node was of the total frame time
const float Percent = Node->TimingResult * 100.0f / (RootResult * 1000.0f);
const float PercentThreshold = GProfileThresholdPercent.GetValueOnRenderThread();
const int32 EffectiveDepth = FMath::Max(Depth - 1, 0);
const bool bDisplayEvent = (bParentMatchedFilter || WildcardFilter.IsMatch(Node->Name)) && (Percent > PercentThreshold || Summary.bDumpEventLeafNodes);
if (bDisplayEvent)
{
FString NodeStats = TEXT("");
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:464
Scope (from outer to inner):
file
function void FGPUProfilerEventNodeFrame::DumpEventTree
Source code excerpt:
}
if (GProfileThresholdPercent.GetValueOnRenderThread() > 0.0f)
{
ConfigString += FString::Printf(TEXT("Threshold: %.2f%% "), GProfileThresholdPercent.GetValueOnRenderThread());
}
if (ConfigString.Len() > 0)
{
ConfigString = FString(TEXT(", ")) + ConfigString;
}