PerfWarn.FineSampleTime
PerfWarn.FineSampleTime
#Overview
name: PerfWarn.FineSampleTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
How many seconds we sample the percentage for the fine-grained minimum FPS.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PerfWarn.FineSampleTime is to define the duration, in seconds, for which the performance monitor samples frame rates to calculate the percentage of frames below a specified threshold for fine-grained performance warnings in Unreal Engine.
This setting variable is primarily used by the performance monitoring system within the UnrealEd module. It’s part of a set of variables that control how the engine monitors and reports performance issues during development.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands or configuration files.
PerfWarn.FineSampleTime interacts with several other variables, including:
- PerfWarn.CoarseSampleTime
- PerfWarn.FineMinFPS
- PerfWarn.CoarseMinFPS
- PerfWarn.FinePercentThreshold
Developers should be aware that changing this variable will affect the sensitivity of the performance warning system. A shorter time will make the system more responsive to brief performance dips, while a longer time will provide a more averaged view of performance over time.
Best practices when using this variable include:
- Adjust it based on the specific needs of your project. For example, if you’re working on a section with rapidly changing performance characteristics, you might want to decrease this value temporarily.
- Use it in conjunction with the other PerfWarn variables to fine-tune the performance monitoring system.
- Be cautious about setting it too low, as this might lead to excessive warnings for brief, inconsequential performance dips.
- Consider the target platform when setting this value, as different platforms may have different performance characteristics.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PerformanceMonitor.cpp:111
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarFineSampleTime(
TEXT("PerfWarn.FineSampleTime"), 30, TEXT("How many seconds we sample the percentage for the fine-grained minimum FPS."), ECVF_Default);
static TAutoConsoleVariable<int32> CVarCoarseSampleTime(
TEXT("PerfWarn.CoarseSampleTime"), 600, TEXT("How many seconds we sample the percentage for the coarse-grained minimum FPS."), ECVF_Default);
static TAutoConsoleVariable<int32> CVarFineMinFPS(
TEXT("PerfWarn.FineMinFPS"), 10, TEXT("The FPS threshold below which we warn about for fine-grained sampling."), ECVF_Default);
static TAutoConsoleVariable<int32> CVarCoarseMinFPS(
TEXT("PerfWarn.CoarseMinFPS"), 20, TEXT("The FPS threshold below which we warn about for coarse-grained sampling."), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PerformanceMonitor.cpp:130
Scope (from outer to inner):
file
function FPerformanceMonitor::FPerformanceMonitor
lambda-function
Source code excerpt:
CVarDelegate = FConsoleCommandDelegate::CreateLambda([this]{
static const auto CVarFine = IConsoleManager::Get().FindConsoleVariable(TEXT("PerfWarn.FineSampleTime"));
static const auto CVarCoarse = IConsoleManager::Get().FindConsoleVariable(TEXT("PerfWarn.CoarseSampleTime"));
static int32 LastTickFine = -1, LastTickCoarse = -1;
if (CVarFine->GetInt() != LastTickFine || CVarCoarse->GetInt() != LastTickCoarse)
{
LastTickFine = CVarFine->GetInt();
LastTickCoarse = CVarCoarse->GetInt();
UpdateMovingAverageSamplers();
}
});
CVarDelegateHandle = IConsoleManager::Get().RegisterConsoleVariableSink_Handle(CVarDelegate);
}
FPerformanceMonitor::~FPerformanceMonitor()
{
IConsoleManager::Get().UnregisterConsoleVariableSink_Handle(CVarDelegateHandle);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PerformanceMonitor.cpp:300
Scope (from outer to inner):
file
function void FPerformanceMonitor::Tick
Source code excerpt:
static IConsoleVariable* CVarMinFPS = IConsoleManager::Get().FindConsoleVariable(TEXT("PerfWarn.FineMinFPS"));
static IConsoleVariable* CVarPercentThreshold = IConsoleManager::Get().FindConsoleVariable(TEXT("PerfWarn.FinePercentThreshold"));
static IConsoleVariable* CVarSampleTime = IConsoleManager::Get().FindConsoleVariable(TEXT("PerfWarn.FineSampleTime"));
PercentUnderTarget = FineMovingAverage.PercentageBelowThreshold(CVarMinFPS->GetFloat());
if (PercentUnderTarget >= CVarPercentThreshold->GetFloat())
{
Arguments.Add(TEXT("Framerate"), CVarMinFPS->GetInt());
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PerformanceMonitor.cpp:427
Scope (from outer to inner):
file
function void FPerformanceMonitor::UpdateMovingAverageSamplers
Source code excerpt:
IConsoleManager& Console = IConsoleManager::Get();
float SampleTime = Console.FindConsoleVariable(TEXT("PerfWarn.FineSampleTime"))->GetFloat();
FineMovingAverage = FMovingAverage(NumberOfSamples, SampleTime / NumberOfSamples);
SampleTime = Console.FindConsoleVariable(TEXT("PerfWarn.CoarseSampleTime"))->GetFloat();
CoarseMovingAverage = FMovingAverage(NumberOfSamples, SampleTime / NumberOfSamples);
}