LogGameThreadFNameChurn.StackIgnore
LogGameThreadFNameChurn.StackIgnore
#Overview
name: LogGameThreadFNameChurn.StackIgnore
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of items to discard from the top of a stack frame.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of LogGameThreadFNameChurn.StackIgnore is to control the number of items to discard from the top of a stack frame when capturing stack traces for FName churn tracking in the game thread.
This setting variable is primarily used in the Core module of Unreal Engine, specifically in the UnrealNames subsystem. It’s part of a performance monitoring and debugging feature that tracks the creation of FNames (string hashes used for optimization in Unreal Engine) on the game thread.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 4, but can be changed at runtime through the console or configuration files.
This variable interacts closely with other CVars related to FName churn tracking, such as CVarLogGameThreadFNameChurn_RemoveAliases, CVarLogGameThreadFNameChurn_StackLen, and CVarLogGameThreadFNameChurn_PrintFrequency. Together, these variables control various aspects of the FName churn tracking system.
Developers should be aware that this variable affects the depth of stack traces captured for FName creation events. A higher value will ignore more of the top-level function calls, which can be useful for filtering out common entry points and focusing on the more specific causes of FName creation.
Best practices when using this variable include:
- Adjusting it if the default value of 4 is not providing useful stack traces.
- Using it in conjunction with the other FName churn tracking CVars for comprehensive debugging.
- Being mindful that very low values might include too much noise in the stack traces, while very high values might exclude important information.
The associated variable CVarLogGameThreadFNameChurn_StackIgnore is the actual CVar object that stores and manages the LogGameThreadFNameChurn.StackIgnore value. It’s used to retrieve the current value of the setting when capturing stack traces (as seen in the CollectSample function).
When working with CVarLogGameThreadFNameChurn_StackIgnore, developers should:
- Use GetValueOnGameThread() to safely retrieve its value, especially from the game thread.
- Be aware that changes to this CVar will affect all subsequent FName churn tracking samples.
- Consider exposing this setting in debug menus or config files for easier tuning during development.
#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:5243
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_StackIgnore(
TEXT("LogGameThreadFNameChurn.StackIgnore"),
4,
TEXT("Number of items to discard from the top of a stack frame."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_RemoveAliases(
TEXT("LogGameThreadFNameChurn.RemoveAliases"),
1,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLogGameThreadFNameChurn_StackIgnore
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5242
Scope: file
Source code excerpt:
TEXT("Number of fname creates per sample. This is used to prevent churn sampling from slowing the game down too much."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_StackIgnore(
TEXT("LogGameThreadFNameChurn.StackIgnore"),
4,
TEXT("Number of items to discard from the top of a stack frame."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_RemoveAliases(
TEXT("LogGameThreadFNameChurn.RemoveAliases"),
#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());