LogGameThreadFNameChurn.RemoveAliases

LogGameThreadFNameChurn.RemoveAliases

#Overview

name: LogGameThreadFNameChurn.RemoveAliases

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 LogGameThreadFNameChurn.RemoveAliases is to control the behavior of FName churn tracking in the Unreal Engine’s naming system. Specifically, it determines whether aliases should be removed from the counting process during FName churn analysis.

This setting variable is primarily used in the Core module of Unreal Engine, specifically within the naming system (UnrealNames.cpp). It’s part of a larger system designed to track and analyze the creation and usage of FName objects on the game thread.

The value of this variable is set through the console variable system (CVar) in Unreal Engine. It’s initialized with a default value of 1, meaning alias removal is enabled by default.

This variable interacts closely with other CVars related to FName churn tracking, such as CVarLogGameThreadFNameChurn_StackLen and CVarLogGameThreadFNameChurn_StackIgnore. These variables collectively control various aspects of the FName churn tracking system.

Developers should be aware that enabling this option (setting it to a value greater than 0) will merge addresses that have the same human-readable string in the tracking process. This can provide a more accurate representation of unique FName usage but at the cost of increased processing time.

Best practices when using this variable include:

  1. Consider performance implications when enabling it, as it can slow down the tracking process.
  2. Use it in conjunction with other FName churn tracking options for a comprehensive analysis.
  3. Adjust its value based on the specific needs of your project and the level of detail required in FName usage analysis.

Regarding the associated variable CVarLogGameThreadFNameChurn_RemoveAliases:

This is the actual CVar object that controls the LogGameThreadFNameChurn.RemoveAliases setting. It’s defined as a TAutoConsoleVariable, which means it’s an integer console variable that can be changed at runtime.

The purpose of this variable is the same as LogGameThreadFNameChurn.RemoveAliases - it controls whether aliases are removed in the FName churn tracking process.

This variable is used directly in the CollectSample() function, where its value is retrieved to determine whether alias removal should be performed during stack trace capture.

Developers should be aware that changes to this CVar will take effect immediately, potentially altering the behavior of FName churn tracking mid-execution.

Best practices for using this CVar include:

  1. Use the console or configuration files to adjust its value rather than hard-coding changes.
  2. Monitor performance impacts when changing its value, especially in performance-critical scenarios.
  3. Consider logging or alerting when this value is changed to maintain awareness of its current state.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5248

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_RemoveAliases(
	TEXT("LogGameThreadFNameChurn.RemoveAliases"),
	1,
	TEXT("If > 0 then remove aliases from the counting process. This essentialy merges addresses that have the same human readable string. It is slower."));

static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_StackLen(
	TEXT("LogGameThreadFNameChurn.StackLen"),
	3,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5247

Scope: file

Source code excerpt:

	TEXT("Number of items to discard from the top of a stack frame."));

static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_RemoveAliases(
	TEXT("LogGameThreadFNameChurn.RemoveAliases"),
	1,
	TEXT("If > 0 then remove aliases from the counting process. This essentialy merges addresses that have the same human readable string. It is slower."));

static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_StackLen(
	TEXT("LogGameThreadFNameChurn.StackLen"),

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5312

Scope (from outer to inner):

file
function     void CollectSample

Source code excerpt:

	{
		check(IsInGameThread());
		GGameThreadFNameChurnTracker.CaptureStackTrace(CVarLogGameThreadFNameChurn_StackIgnore.GetValueOnGameThread(), nullptr, CVarLogGameThreadFNameChurn_StackLen.GetValueOnGameThread(), CVarLogGameThreadFNameChurn_RemoveAliases.GetValueOnGameThread() > 0);
	}
	void PrintResultsAndReset()
	{
		DumpFrame = GFrameCounter + CVarLogGameThreadFNameChurn_PrintFrequency.GetValueOnGameThread();
		FOutputDeviceRedirector* Log = FOutputDeviceRedirector::Get();
		float SampleAndFrameCorrection = float(CVarLogGameThreadFNameChurn_SampleFrequency.GetValueOnGameThread()) / float(CVarLogGameThreadFNameChurn_PrintFrequency.GetValueOnGameThread());