sg.Test.CPUPerfIndexOverride
sg.Test.CPUPerfIndexOverride
#Overview
name: sg.Test.CPUPerfIndexOverride
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Custom override for the CPU perf index returned by the GPU benchmark.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of sg.Test.CPUPerfIndexOverride is to provide a custom override for the CPU performance index used in the Unreal Engine’s scalability system. This variable is specifically designed for testing and debugging purposes.
This setting variable is primarily used in the Scalability module of Unreal Engine, which is responsible for adjusting game quality settings based on the performance capabilities of the user’s hardware.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 0.0f.
The associated variable CVarTestCPUPerfIndexOverride interacts directly with sg.Test.CPUPerfIndexOverride. They share the same value and purpose.
Developers must be aware that:
- This variable is only available in non-shipping builds (#if !UE_BUILD_SHIPPING).
- It’s intended for testing purposes and should not be relied upon for production code.
- When set to a value greater than 0.0f, it overrides the actual CPU performance index calculated by the engine.
Best practices when using this variable include:
- Use it only for testing and debugging scenarios.
- Reset it to 0.0f after testing to ensure normal operation of the scalability system.
- Be cautious when using it in multiplayer scenarios, as it could lead to inconsistent experiences across different machines.
Regarding the associated variable CVarTestCPUPerfIndexOverride:
- It serves the same purpose as sg.Test.CPUPerfIndexOverride.
- It’s used to actually retrieve and apply the override value in the BenchmarkQualityLevels function.
- The value is accessed using GetValueOnAnyThread(), which suggests it can be safely accessed from any thread.
- Like sg.Test.CPUPerfIndexOverride, it should only be used for testing and debugging, and with the same precautions mentioned above.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:19
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarTestCPUPerfIndexOverride(
TEXT("sg.Test.CPUPerfIndexOverride"), 0.0f,
TEXT("Custom override for the CPU perf index returned by the GPU benchmark."),
ECVF_Default);
static TAutoConsoleVariable<float> CVarTestGPUPerfIndexOverride(
TEXT("sg.Test.GPUPerfIndexOverride"), 0.0f,
TEXT("Custom override for the GPU perf index returned by the GPU benchmark."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarTestCPUPerfIndexOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:18
Scope: file
Source code excerpt:
#if !UE_BUILD_SHIPPING
static TAutoConsoleVariable<float> CVarTestCPUPerfIndexOverride(
TEXT("sg.Test.CPUPerfIndexOverride"), 0.0f,
TEXT("Custom override for the CPU perf index returned by the GPU benchmark."),
ECVF_Default);
static TAutoConsoleVariable<float> CVarTestGPUPerfIndexOverride(
TEXT("sg.Test.GPUPerfIndexOverride"), 0.0f,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scalability.cpp:689
Scope (from outer to inner):
file
namespace Scalability
function FQualityLevels BenchmarkQualityLevels
Source code excerpt:
#if !UE_BUILD_SHIPPING
if (CVarTestCPUPerfIndexOverride.GetValueOnAnyThread() > 0.0f)
{
CPUPerfIndex = CVarTestCPUPerfIndexOverride.GetValueOnAnyThread();
}
if (CVarTestGPUPerfIndexOverride.GetValueOnAnyThread() > 0.0f)
{
GPUPerfIndex = CVarTestGPUPerfIndexOverride.GetValueOnAnyThread();
}
#endif