LogGameThreadFNameChurn.Threshhold
LogGameThreadFNameChurn.Threshhold
#Overview
name: LogGameThreadFNameChurn.Threshhold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimum average number of fname creations per frame to include in the report.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of LogGameThreadFNameChurn.Threshhold is to set a minimum threshold for reporting FName creation churn on the game thread. This setting is part of Unreal Engine’s performance monitoring and optimization system, specifically focusing on FName (string) allocations.
This setting variable is primarily used in the Core module of Unreal Engine, particularly in the UnrealNames system. It’s part of a broader mechanism to track and report on FName creation frequency, which can be a source of performance issues if not managed properly.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 10, but can be changed at runtime through console commands or configuration files.
This variable interacts closely with other related variables, such as CVarLogGameThreadFNameChurn_SampleFrequency and CVarLogGameThreadFNameChurn_PrintFrequency. Together, these variables control the sampling, thresholding, and reporting of FName churn.
Developers should be aware that this variable directly affects the sensitivity of FName churn reporting. Setting it too low might result in excessive logging, while setting it too high might cause important churn events to go unnoticed.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project.
- Using it in conjunction with the other FName churn tracking variables for comprehensive monitoring.
- Regularly reviewing the logs produced by this system to identify and address potential performance issues related to FName creation.
Regarding the associated variable CVarLogGameThreadFNameChurn_Threshhold:
This is the actual console variable that stores and provides access to the LogGameThreadFNameChurn.Threshhold value. It’s of type TAutoConsoleVariable
The purpose of CVarLogGameThreadFNameChurn_Threshhold is to provide a programmatic interface to get and set the threshold value. It’s used directly in the code to retrieve the current threshold value when performing the FName churn analysis.
This variable is set in the Core module and is used in the FName churn tracking system. Its value is retrieved using the GetValueOnGameThread() method, ensuring thread-safe access when used on the game thread.
Developers should be aware that changes to this CVar will immediately affect the FName churn reporting behavior. It’s important to use the appropriate methods (like GetValueOnGameThread()) when accessing this value to ensure thread safety.
Best practices for using CVarLogGameThreadFNameChurn_Threshhold include:
- Using it for runtime adjustments of the threshold value during development and debugging.
- Considering exposing it in development builds for easier tuning.
- Documenting any project-specific default values or recommendations for this setting.
#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:5233
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_Threshhold(
TEXT("LogGameThreadFNameChurn.Threshhold"),
10,
TEXT("Minimum average number of fname creations per frame to include in the report."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_SampleFrequency(
TEXT("LogGameThreadFNameChurn.SampleFrequency"),
1,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLogGameThreadFNameChurn_Threshhold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5232
Scope: file
Source code excerpt:
TEXT("Number of frames between churn reports."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_Threshhold(
TEXT("LogGameThreadFNameChurn.Threshhold"),
10,
TEXT("Minimum average number of fname creations per frame to include in the report."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_SampleFrequency(
TEXT("LogGameThreadFNameChurn.SampleFrequency"),
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5319
Scope (from outer to inner):
file
function void PrintResultsAndReset
Source code excerpt:
FOutputDeviceRedirector* Log = FOutputDeviceRedirector::Get();
float SampleAndFrameCorrection = float(CVarLogGameThreadFNameChurn_SampleFrequency.GetValueOnGameThread()) / float(CVarLogGameThreadFNameChurn_PrintFrequency.GetValueOnGameThread());
GGameThreadFNameChurnTracker.DumpStackTraces(CVarLogGameThreadFNameChurn_Threshhold.GetValueOnGameThread(), *Log, SampleAndFrameCorrection);
GGameThreadFNameChurnTracker.ResetTracking();
}
};
FSampleFNameChurn GGameThreadFNameChurnTracker;