csv.RecordActorCountsThreshold

csv.RecordActorCountsThreshold

#Overview

name: csv.RecordActorCountsThreshold

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 csv.RecordActorCountsThreshold is to set a threshold for recording actor counts to CSV statistics. It is used in the profiling and performance monitoring system of Unreal Engine 5, specifically for tracking actor instances in a game world.

This setting variable is primarily used in the Engine module, particularly in the level ticking and profiling subsystems. Based on the callsites, it’s referenced in the LevelTick.cpp file, which is responsible for managing the tick process of levels and actors in the game world.

The value of this variable is set as a console variable with a default value of 5. It can be modified at runtime through the console or configuration files.

The associated variable CVarRecordActorCountsToCSVThreshold directly interacts with csv.RecordActorCountsThreshold. They share the same value and purpose.

Developers should be aware that this variable affects the granularity of actor count reporting in CSV profiling. Only actor classes with instance counts exceeding this threshold will be recorded in the CSV stats. This helps in reducing noise in the profiling data by focusing on more frequently occurring actor types.

Best practices when using this variable include:

  1. Adjusting the threshold based on the scale and complexity of your game world.
  2. Using it in conjunction with other profiling tools to get a comprehensive view of performance.
  3. Considering the performance impact of very low thresholds in large worlds with many actor types.

Regarding the associated variable CVarRecordActorCountsToCSVThreshold:

Its purpose is identical to csv.RecordActorCountsThreshold - it sets the threshold for recording actor counts to CSV statistics.

It is used in the same Engine module and level ticking system as csv.RecordActorCountsThreshold.

The value is set through the TAutoConsoleVariable template, which allows it to be modified at runtime.

It directly interacts with the CSVActorClassNameToCountMap and is used in the RecordWorldCountsToCSV function to determine which actor counts should be recorded.

Developers should be aware that this variable is the actual implementation of the console command, and changes to it will directly affect the CSV recording behavior.

Best practices include using this variable for fine-tuning profiling output and adjusting it based on the specific needs of the project and the performance characteristics being investigated.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelTick.cpp:1199

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRecordActorCountsToCSVThreshold(
	TEXT("csv.RecordActorCountsThreshold"),
	5,
	TEXT("Number of instances of an native Actor class required before recording to CSV stat"));

extern TMap<FName, int32> CSVActorClassNameToCountMap;
extern int32 CSVActorTotalCount;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelTick.cpp:1198

Scope: file

Source code excerpt:

	TEXT("Record actor counts by class when performing CSV capture"));

static TAutoConsoleVariable<int32> CVarRecordActorCountsToCSVThreshold(
	TEXT("csv.RecordActorCountsThreshold"),
	5,
	TEXT("Number of instances of an native Actor class required before recording to CSV stat"));

extern TMap<FName, int32> CSVActorClassNameToCountMap;
extern int32 CSVActorTotalCount;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelTick.cpp:1233

Scope (from outer to inner):

file
function     static void RecordWorldCountsToCSV

Source code excerpt:

			CSV_SCOPED_TIMING_STAT_EXCLUSIVE(RecordActorCountsToCSV);

			const int32 Threshold = CVarRecordActorCountsToCSVThreshold.GetValueOnAnyThread();

			for (auto It = CSVActorClassNameToCountMap.CreateConstIterator(); It; ++It)
			{
				if (It->Value > Threshold)
				{
					FCsvProfiler::Get()->RecordCustomStat(It->Key, CSV_CATEGORY_INDEX(ActorCount), It->Value, ECsvCustomStatOp::Set);