abtest.ReportNum

abtest.ReportNum

#Overview

name: abtest.ReportNum

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 abtest.ReportNum is to control the frequency of reporting in Unreal Engine’s A/B testing system. It specifies the number of frames between reports in the A/B testing process.

This setting variable is primarily used in the A/B testing subsystem of Unreal Engine, which is part of the Core module, specifically in the ProfilingDebugging component. This can be seen from the file path where the variable is defined: Engine/Source/Runtime/Core/Private/ProfilingDebugging/ABTesting.cpp.

The value of this variable is set using a TAutoConsoleVariable, which means it can be changed at runtime through the console. The default value is set to 100 frames.

The associated variable CVarABTestReportNum directly interacts with abtest.ReportNum. It’s the C++ representation of the console variable and is used to access the value in the code.

Developers must be aware that changing this variable will affect the frequency of A/B test reports. A lower value will result in more frequent reports, which could potentially impact performance if set too low. Conversely, a higher value will reduce the frequency of reports, which might delay the detection of significant changes in the A/B test.

Best practices when using this variable include:

  1. Balancing between report frequency and performance impact.
  2. Coordinating with other A/B testing variables like abtest.History and abtest.CoolDown for optimal testing results.
  3. Considering the nature of the test when setting this value - faster-paced games might benefit from more frequent reports.

Regarding the associated variable CVarABTestReportNum:

The purpose of CVarABTestReportNum is to provide a programmatic interface to the abtest.ReportNum console variable within the C++ code.

It’s used in the FABTest::Start function to initialize the ReportNum member variable of the FABTest class. This suggests that the value is read at the start of an A/B test and used throughout its duration.

Developers should be aware that changes to the console variable during runtime will not automatically update the ReportNum in an ongoing test - it’s only read at the start of a test.

Best practices for using CVarABTestReportNum include:

  1. Using GetValueOnGameThread() when reading the value to ensure thread-safety.
  2. Considering re-reading the value periodically if long-running tests need to adapt to console changes.
  3. Using this variable instead of hardcoding values when implementing A/B test-related functionality.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/ABTesting.cpp:26

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarABTestReportNum(
	TEXT("abtest.ReportNum"),
	100,
	TEXT("Number of frames between reports."));

static TAutoConsoleVariable<int32> CVarABTestCoolDown(
	TEXT("abtest.CoolDown"),
	5,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/ABTesting.cpp:25

Scope: file

Source code excerpt:

	TEXT("Number of history frames to use for stats."));

static TAutoConsoleVariable<int32> CVarABTestReportNum(
	TEXT("abtest.ReportNum"),
	100,
	TEXT("Number of frames between reports."));

static TAutoConsoleVariable<int32> CVarABTestCoolDown(
	TEXT("abtest.CoolDown"),

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/ABTesting.cpp:346

Scope (from outer to inner):

file
function     void FABTest::Start

Source code excerpt:


	HistoryNum = CVarABTestHistory.GetValueOnGameThread();
	ReportNum = CVarABTestReportNum.GetValueOnGameThread();
	CoolDown = CVarABTestCoolDown.GetValueOnGameThread();
	MinFramesPerTrial = CVarABTestMinFramesPerTrial.GetValueOnGameThread();
	NumResamples = CVarABTestNumResamples.GetValueOnGameThread();

	Samples.Empty(HistoryNum);
	ResampleAccumulators.Empty(NumResamples);