t.FPSChart.ExcludeIdleTime
t.FPSChart.ExcludeIdleTime
#Overview
name: t.FPSChart.ExcludeIdleTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Should we exclude idle time (i.e. one which we spent sleeping) when doing a FPS chart?\n default: 0
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of t.FPSChart.ExcludeIdleTime is to control whether idle time should be excluded when creating FPS (Frames Per Second) charts in Unreal Engine 5. This setting is primarily used in the performance tracking and analysis system of the engine.
This setting variable is mainly utilized by the Engine module, specifically in the performance tracking and chart creation subsystems. The key files involved are ChartCreation.cpp and ChartCreation.h, which are part of the core engine functionality.
The value of this variable is set through a console variable (cvar) system. It’s defined as a TAutoConsoleVariable
The associated variable GFPSChartExcludeIdleTime directly interacts with t.FPSChart.ExcludeIdleTime. They share the same value and purpose.
Developers must be aware that:
- This variable affects how frame times are calculated in FPS charts.
- When enabled (set to non-zero), it excludes idle time (time spent sleeping when the game is running faster than the target frame rate) from the FPS calculations.
- This can significantly impact the reported performance metrics, especially for games that frequently run above their target frame rate.
Best practices when using this variable include:
- Consider enabling it (setting to 1) when you want to focus on actual processing time rather than including idle time in performance measurements.
- Be consistent in its usage across different performance testing sessions to ensure comparable results.
- Document whether this setting was enabled or disabled when reporting performance metrics, as it can significantly affect the results.
Regarding the associated variable GFPSChartExcludeIdleTime:
- It’s the actual console variable that controls this functionality.
- It’s used in various parts of the performance tracking system to determine whether to exclude idle time.
- The ShouldExcludeIdleTimeFromCharts() function in FPerformanceTrackingSystem class uses this variable to determine the exclusion behavior.
- When creating performance reports or analytics, this variable’s value is included to provide context for the performance data.
Developers should use GFPSChartExcludeIdleTime.GetValueOnGameThread() to retrieve the current value of this setting in their code if they need to make decisions based on whether idle time is being excluded in performance measurements.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ChartCreation.cpp:38
Scope: file
Source code excerpt:
// Should we subtract off idle time spent waiting (due to running above target framerate) before thresholding into bins?
static TAutoConsoleVariable<int32> GFPSChartExcludeIdleTime(
TEXT("t.FPSChart.ExcludeIdleTime"),
0,
TEXT("Should we exclude idle time (i.e. one which we spent sleeping) when doing a FPS chart?\n")
TEXT(" default: 0"));
// Should we explore to the folder that contains the .log / etc... when a dump is finished? This can be disabled for automated testing
static TAutoConsoleVariable<int32> GFPSChartOpenFolderOnDump(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ChartCreation.h:48
Scope (from outer to inner):
file
class class IPerformanceDataConsumer
Source code excerpt:
struct FFrameData
{
// Estimate of how long the last frame was (this is either TrueDeltaSeconds or TrueDeltaSeconds - IdleSeconds, depending on the cvar t.FPSChart.ExcludeIdleTime)
double DeltaSeconds;
// Time elapsed since the last time the performance tracking system ran
double TrueDeltaSeconds;
// How long did we burn idling until this frame (FApp::GetIdleTime) (e.g., when running faster than a frame rate target on a dedicated server)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ChartCreation.h:410
Scope: file
Source code excerpt:
// Should we subtract off idle time spent waiting (due to running above target framerate) before thresholding into bins?
// (controlled by t.FPSChart.ExcludeIdleTime)
static ENGINE_API bool ShouldExcludeIdleTimeFromCharts();
private:
/** Start time of current FPS chart */
double FPSChartStartTime;
#Associated Variable and Callsites
This variable is associated with another variable named GFPSChartExcludeIdleTime
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ChartCreation.cpp:37
Scope: file
Source code excerpt:
// Should we subtract off idle time spent waiting (due to running above target framerate) before thresholding into bins?
static TAutoConsoleVariable<int32> GFPSChartExcludeIdleTime(
TEXT("t.FPSChart.ExcludeIdleTime"),
0,
TEXT("Should we exclude idle time (i.e. one which we spent sleeping) when doing a FPS chart?\n")
TEXT(" default: 0"));
// Should we explore to the folder that contains the .log / etc... when a dump is finished? This can be disabled for automated testing
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ChartCreation.cpp:206
Scope (from outer to inner):
file
function void FDumpFPSChartToEndpoint::HandleBasicStats
Source code excerpt:
PrintToEndpoint(FString::Printf(TEXT("BoundRenderThreadPct: %4.2f"), BoundRenderThreadPct));
PrintToEndpoint(FString::Printf(TEXT("BoundGPUPct: %4.2f"), BoundGPUPct));
PrintToEndpoint(FString::Printf(TEXT("ExcludeIdleTime: %d"), GFPSChartExcludeIdleTime.GetValueOnGameThread()));
}
void FDumpFPSChartToEndpoint::DumpChart(double InWallClockTimeFromStartOfCharting, FString InMapName, FString InDeviceProfileName)
{
FillOutMemberStats();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ChartCreation.cpp:410
Scope (from outer to inner):
file
function virtual void HandleBasicStats
Source code excerpt:
ParamArray.Add(FAnalyticsEventAttribute(TEXT("PercentRenderThreadBound"), FString::Printf(TEXT("%4.2f"), BoundRenderThreadPct)));
ParamArray.Add(FAnalyticsEventAttribute(TEXT("ExcludeIdleTime"), FString::Printf(TEXT("%d"), GFPSChartExcludeIdleTime.GetValueOnGameThread())));
}
};
//////////////////////////////////////////////////////////////////////
struct FDumpFPSChartToLogEndpoint : public FDumpFPSChartToEndpoint
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ChartCreation.cpp:1188
Scope (from outer to inner):
file
function bool FPerformanceTrackingSystem::ShouldExcludeIdleTimeFromCharts
Source code excerpt:
bool FPerformanceTrackingSystem::ShouldExcludeIdleTimeFromCharts()
{
return GFPSChartExcludeIdleTime.GetValueOnGameThread() != 0;
}
IPerformanceDataConsumer::FFrameData FPerformanceTrackingSystem::AnalyzeFrame(float DeltaSeconds)
{
const float MSToSeconds = 1.0f / 1000.0f;