sg.Test.CPUPerfIndexOverride

sg.Test.CPUPerfIndexOverride

#Overview

name: sg.Test.CPUPerfIndexOverride

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 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:

  1. This variable is only available in non-shipping builds (#if !UE_BUILD_SHIPPING).
  2. It’s intended for testing purposes and should not be relied upon for production code.
  3. 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:

  1. Use it only for testing and debugging scenarios.
  2. Reset it to 0.0f after testing to ensure normal operation of the scalability system.
  3. Be cautious when using it in multiplayer scenarios, as it could lead to inconsistent experiences across different machines.

Regarding the associated variable CVarTestCPUPerfIndexOverride:

#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