LogGameThreadFNameChurn.PrintFrequency
LogGameThreadFNameChurn.PrintFrequency
#Overview
name: LogGameThreadFNameChurn.PrintFrequency
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of frames between churn reports.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of LogGameThreadFNameChurn.PrintFrequency is to control the frequency of FName churn reports in the game thread. It is used as part of a debugging and profiling system to monitor the creation of FNames, which are string-like identifiers used extensively in Unreal Engine.
This setting variable is primarily used in the Core module of Unreal Engine, specifically in the UnrealNames.cpp file, which is part of the UObject system. It’s used in conjunction with other related variables to manage the tracking and reporting of FName creation.
The value of this variable is set through the console variable system (CVars) in Unreal Engine. It can be modified at runtime using console commands or through configuration files.
LogGameThreadFNameChurn.PrintFrequency interacts with several other variables:
- CVarLogGameThreadFNameChurn_SampleFrequency
- CVarLogGameThreadFNameChurn_Threshhold
These variables work together to control the sampling, thresholding, and reporting of FName churn.
Developers should be aware that:
- This variable directly affects the frequency of performance reports, which can impact performance itself if set too low.
- It’s part of a debugging system and should be used judiciously in production builds.
Best practices for using this variable include:
- Setting it to a reasonable value that balances the need for information with performance impact.
- Using it in conjunction with the other related variables for a comprehensive view of FName churn.
- Adjusting it based on the specific needs of the project and the stage of development.
Regarding the associated variable CVarLogGameThreadFNameChurn_PrintFrequency: This is the actual CVar (Console Variable) object that corresponds to the LogGameThreadFNameChurn.PrintFrequency setting. It’s initialized with a default value of 300, meaning reports will be generated every 300 frames by default. The variable is used in the NameCreationHook and PrintResultsAndReset functions to determine when to generate and print FName churn reports. Developers can modify this value through the console or configuration files to adjust the reporting frequency as needed during development or debugging sessions.
#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:5228
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_PrintFrequency(
TEXT("LogGameThreadFNameChurn.PrintFrequency"),
300,
TEXT("Number of frames between churn reports."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_Threshhold(
TEXT("LogGameThreadFNameChurn.Threshhold"),
10,
#Associated Variable and Callsites
This variable is associated with another variable named CVarLogGameThreadFNameChurn_PrintFrequency
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5227
Scope: file
Source code excerpt:
TEXT("If > 0, then collect sample game thread fname create, periodically print a report of the worst offenders."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_PrintFrequency(
TEXT("LogGameThreadFNameChurn.PrintFrequency"),
300,
TEXT("Number of frames between churn reports."));
static TAutoConsoleVariable<int32> CVarLogGameThreadFNameChurn_Threshhold(
TEXT("LogGameThreadFNameChurn.Threshhold"),
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5282
Scope (from outer to inner):
file
function void NameCreationHook
Source code excerpt:
{
CountDown = CVarLogGameThreadFNameChurn_SampleFrequency.GetValueOnGameThread();
DumpFrame = GFrameCounter + CVarLogGameThreadFNameChurn_PrintFrequency.GetValueOnGameThread();
GGameThreadFNameChurnTracker.ResetTracking();
GGameThreadFNameChurnTracker.ToggleTracking(true, true);
}
else
{
GGameThreadFNameChurnTracker.ToggleTracking(false, true);
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/UObject/UnrealNames.cpp:5316
Scope (from outer to inner):
file
function void PrintResultsAndReset
Source code excerpt:
void PrintResultsAndReset()
{
DumpFrame = GFrameCounter + CVarLogGameThreadFNameChurn_PrintFrequency.GetValueOnGameThread();
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;