r.ShaderCompiler.StatsPrintoutInterval
r.ShaderCompiler.StatsPrintoutInterval
#Overview
name: r.ShaderCompiler.StatsPrintoutInterval
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimum interval (in seconds) between printing out debugging stats (by default, no closer than once per minute).
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderCompiler.StatsPrintoutInterval is to control the minimum interval between printing out debugging stats for the shader compiler. This setting is part of Unreal Engine’s shader compilation system, which is crucial for rendering and graphics performance.
This setting variable is primarily used in the UnrealEd module, specifically within the shader statistics collection and reporting system. The UnrealEd module is responsible for editor functionality in Unreal Engine.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of 180 seconds (3 minutes) but can be changed during runtime.
The associated variable CVarShaderCompilerStatsPrintoutInterval interacts directly with r.ShaderCompiler.StatsPrintoutInterval. They share the same value and purpose.
Developers should be aware that:
- This variable affects the frequency of shader compiler stats printouts, which can be useful for debugging but may impact performance if set too low.
- The value is in seconds, with a default of 180 (3 minutes).
- Setting it to 0 or a negative value will effectively disable the automatic printouts.
Best practices when using this variable include:
- Leave it at the default value during normal development to avoid unnecessary console spam.
- Increase the interval in production builds to minimize potential performance impact.
- Decrease the interval temporarily when actively debugging shader compilation issues.
- Use in conjunction with other shader compiler-related CVars for comprehensive debugging.
Regarding the associated variable CVarShaderCompilerStatsPrintoutInterval:
- It’s the actual TAutoConsoleVariable instance that controls the behavior.
- It’s used in the FShaderStatsReporter::InternalTick and FShaderStatsAggregator::ClientTick functions to determine when to log stats or synchronize data.
- The value is retrieved using GetValueOnAnyThread(), which suggests it’s safe to access from multiple threads.
- When modifying the r.ShaderCompiler.StatsPrintoutInterval CVar, you’re actually changing the value of this associated variable.
Developers should treat both r.ShaderCompiler.StatsPrintoutInterval and CVarShaderCompilerStatsPrintoutInterval as the same entity when considering their effects on the shader compilation system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/ShaderStatsCollector.cpp:6
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int> CVarShaderCompilerStatsPrintoutInterval(
TEXT("r.ShaderCompiler.StatsPrintoutInterval"),
180,
TEXT("Minimum interval (in seconds) between printing out debugging stats (by default, no closer than once per minute)."),
ECVF_Default
);
static TAutoConsoleVariable<bool> CVarShaderCompilerPrintIndividualProcessStats(
#Associated Variable and Callsites
This variable is associated with another variable named CVarShaderCompilerStatsPrintoutInterval
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/ShaderStatsCollector.cpp:5
Scope: file
Source code excerpt:
#include "Serialization/CompactBinaryWriter.h"
static TAutoConsoleVariable<int> CVarShaderCompilerStatsPrintoutInterval(
TEXT("r.ShaderCompiler.StatsPrintoutInterval"),
180,
TEXT("Minimum interval (in seconds) between printing out debugging stats (by default, no closer than once per minute)."),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/ShaderStatsCollector.cpp:89
Scope (from outer to inner):
file
function void FShaderStatsReporter::InternalTick
Source code excerpt:
void FShaderStatsReporter::InternalTick(float DeltaTime, bool bForceLog)
{
const int PrintInterval = CVarShaderCompilerStatsPrintoutInterval.GetValueOnAnyThread();
if (bForceLog || ((PrintInterval > 0) && (FPlatformTime::Seconds() - LastLogTime) >= PrintInterval))
{
LastLogTime = FPlatformTime::Seconds();
LogStats();
}
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/ShaderStatsCollector.cpp:154
Scope (from outer to inner):
file
function void FShaderStatsAggregator::ClientTick
Source code excerpt:
void FShaderStatsAggregator::ClientTick(UE::Cook::FMPCollectorClientTickContext& Context)
{
const int PrintInterval = CVarShaderCompilerStatsPrintoutInterval.GetValueOnAnyThread();
// synch stats twice as often as they are printed to ensure each stats print on the cook director
// has at least one update from all workers.
const int SynchInterval = PrintInterval / 2;
if (Context.IsFlush() || ((SynchInterval > 0) && (FPlatformTime::Seconds() - LastSynchTime) >= PrintInterval))
{