t.UnacceptableFrameTimeThreshold
t.UnacceptableFrameTimeThreshold
#Overview
name: t.UnacceptableFrameTimeThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The frame time theshold for what is considered completely unacceptable (in ms); values above this will be drawn as red\n default: 50.0 ms
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of t.UnacceptableFrameTimeThreshold is to define a threshold for frame rendering time that is considered completely unacceptable in the Unreal Engine 5 performance monitoring system.
This setting variable is primarily used by the Engine module, specifically within the performance monitoring and visualization subsystems. It’s utilized to determine the color coding for frame time display in debugging and profiling tools.
The value of this variable is set through a console variable (CVar) system. It’s defined with a default value of 50.0 milliseconds, but can be adjusted at runtime or through configuration files.
The associated variable GUnacceptableFrameTimeThresholdCVar interacts directly with t.UnacceptableFrameTimeThreshold. It’s the actual CVar object that stores and manages the value of the threshold.
Developers must be aware that this variable is used for cosmetic purposes in fps/stat displays and should not be used directly in scalability code. It’s primarily for visualization and debugging purposes.
Best practices when using this variable include:
- Use it in conjunction with other performance metrics for a comprehensive view of engine performance.
- Adjust the value based on the specific requirements of your project and target platforms.
- Remember that it’s a visual aid and not a direct performance optimization tool.
Regarding the associated variable GUnacceptableFrameTimeThresholdCVar:
- It’s the actual implementation of the t.UnacceptableFrameTimeThreshold console variable.
- It’s defined with the ECVF_Scalability flag, indicating it’s related to scalability settings.
- The value can be accessed in code using GetValueOnGameThread() method, as seen in the FEnginePerformanceTargets::GetUnacceptableFrameTimeThresholdMS() function.
- When adjusting this value, consider the impact on the visual feedback provided to developers and testers about frame performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Performance/EnginePerformanceTargets.cpp:8
Scope: file
Source code excerpt:
// Values above this will be red, values between this and the acceptable limit will be yellow, and values below will be green.
static TAutoConsoleVariable<float> GUnacceptableFrameTimeThresholdCVar(
TEXT("t.UnacceptableFrameTimeThreshold"),
50.0f,
TEXT("The frame time theshold for what is considered completely unacceptable (in ms); values above this will be drawn as red\n")
TEXT(" default: 50.0 ms"),
ECVF_Scalability);
// The target threshold for frame time in miliseconds (*cosmetic only* and used for fps/stat display, should not be used in scalability code)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:2446
Scope: file
Source code excerpt:
/**
* Returns the display color for a given frame time (based on t.TargetFrameTimeThreshold and t.UnacceptableFrameTimeThreshold)
*/
ENGINE_API FColor GetFrameTimeDisplayColor(float FrameTimeMS) const;
/**
* @return true to throttle CPU usage based on current state (usually editor minimized or not in foreground)
*/
ENGINE_API virtual bool ShouldThrottleCPUUsage() const;
#Associated Variable and Callsites
This variable is associated with another variable named GUnacceptableFrameTimeThresholdCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Performance/EnginePerformanceTargets.cpp:7
Scope: file
Source code excerpt:
// The maximum threshold for an 'OK' frame time in miliseconds (*cosmetic only* and used for fps/stat display, should not be used in scalability code)
// Values above this will be red, values between this and the acceptable limit will be yellow, and values below will be green.
static TAutoConsoleVariable<float> GUnacceptableFrameTimeThresholdCVar(
TEXT("t.UnacceptableFrameTimeThreshold"),
50.0f,
TEXT("The frame time theshold for what is considered completely unacceptable (in ms); values above this will be drawn as red\n")
TEXT(" default: 50.0 ms"),
ECVF_Scalability);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Performance/EnginePerformanceTargets.cpp:58
Scope (from outer to inner):
file
function float FEnginePerformanceTargets::GetUnacceptableFrameTimeThresholdMS
Source code excerpt:
float FEnginePerformanceTargets::GetUnacceptableFrameTimeThresholdMS()
{
return GUnacceptableFrameTimeThresholdCVar.GetValueOnGameThread();
}
float FEnginePerformanceTargets::GetHitchFrameTimeThresholdMS()
{
return GHitchThresholdMS;
}