RHI.GPUHitchThreshold

RHI.GPUHitchThreshold

#Overview

name: RHI.GPUHitchThreshold

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 RHI.GPUHitchThreshold is to set a threshold for detecting hitches on the GPU. It is used in the rendering system, specifically within the RHI (Rendering Hardware Interface) subsystem of Unreal Engine 5.

This setting variable is primarily relied upon by the RHI module, which is a core part of Unreal Engine’s rendering system. It’s used to identify performance issues related to GPU processing.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 100.0f milliseconds, but can be changed at runtime through console commands or configuration files.

The associated variable GGPUHitchThresholdCVar interacts directly with RHI.GPUHitchThreshold. This is the actual TAutoConsoleVariable object that stores and manages the threshold value.

Developers must be aware that this threshold is in milliseconds. When using this variable, they should consider the target frame rate of their application and set the threshold accordingly. A lower threshold will be more sensitive to hitches but may also produce more false positives.

Best practices when using this variable include:

  1. Adjusting the threshold based on the specific needs of the project and target hardware.
  2. Using it in conjunction with other performance monitoring tools to get a comprehensive view of GPU performance.
  3. Being cautious about setting the threshold too low, as it may lead to excessive logging or false alarms.

Regarding the associated variable GGPUHitchThresholdCVar:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> GGPUHitchThresholdCVar(
	TEXT("RHI.GPUHitchThreshold"),
	100.0f,
	TEXT("Threshold for detecting hitches on the GPU (in milliseconds).")
	);
static TAutoConsoleVariable<int32> GCVarRHIRenderPass(
	TEXT("r.RHIRenderPasses"),
	0,

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT("0:off, 1:on (default)"),
	ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> GGPUHitchThresholdCVar(
	TEXT("RHI.GPUHitchThreshold"),
	100.0f,
	TEXT("Threshold for detecting hitches on the GPU (in milliseconds).")
	);
static TAutoConsoleVariable<int32> GCVarRHIRenderPass(
	TEXT("r.RHIRenderPasses"),

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

Scope (from outer to inner):

file
namespace    RHIConfig
function     float GetGPUHitchThreshold

Source code excerpt:

	float GetGPUHitchThreshold()
	{
		return GGPUHitchThresholdCVar.GetValueOnAnyThread() * 0.001f;
	}
}

// By default, read only states and UAV states are allowed to participate in state merging.
ERHIAccess GRHIMergeableAccessMask = ERHIAccess::ReadOnlyMask | ERHIAccess::UAVMask;