n.IpNetDriverMaxFrameTimeBeforeAlert
n.IpNetDriverMaxFrameTimeBeforeAlert
#Overview
name: n.IpNetDriverMaxFrameTimeBeforeAlert
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Time to spend processing networking data in a single frame before an alert is raised (in seconds)\nIt may get called multiple times in a single frame if additional processing after a previous alert exceeds the threshold again\n default: 1 s
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of n.IpNetDriverMaxFrameTimeBeforeAlert is to set a threshold for the maximum time allowed for processing networking data in a single frame before raising an alert. This setting is used in the networking system of Unreal Engine 5, specifically within the IpNetDriver component.
This setting variable is primarily relied upon by the Online Subsystem Utils plugin, which is part of Unreal Engine’s networking infrastructure. It’s used in the IpNetDriver class, which is responsible for managing network communication over IP protocols.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 second, but can be changed at runtime using console commands or through configuration files.
The n.IpNetDriverMaxFrameTimeBeforeAlert variable interacts directly with GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs. They share the same value, with GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs being the actual float variable used in the code, while n.IpNetDriverMaxFrameTimeBeforeAlert is the console variable name used to set and access this value.
Developers must be aware that this variable affects the responsiveness of the networking system. If set too low, it might cause frequent alerts that could impact performance. If set too high, it might delay the detection of networking issues.
Best practices when using this variable include:
- Monitoring its impact on performance and adjusting as needed.
- Using it in conjunction with other networking diagnostics tools.
- Setting it appropriately based on the game’s networking requirements and target platforms.
Regarding the associated variable GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs:
The purpose of GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs is to store the actual float value used in the code to determine when to raise an alert for excessive networking processing time.
This variable is used directly in the IpNetDriver’s packet processing logic. It’s used to calculate an “AlarmTime” which, when exceeded, triggers a broadcast of the OnNetworkProcessingCausingSlowFrame event.
The value of this variable is set through the n.IpNetDriverMaxFrameTimeBeforeAlert console variable.
GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs interacts closely with the packet processing loop in the IpNetDriver. It’s used to determine when to raise alerts and potentially adjust processing behavior.
Developers should be aware that this variable directly impacts when slow frame alerts are triggered. Adjusting it will change the sensitivity of the system to networking-related performance issues.
Best practices for using this variable include:
- Monitoring its impact on alert frequency and adjusting based on the specific needs of the game.
- Using it in conjunction with other performance monitoring tools to get a comprehensive view of networking performance.
- Considering the target platforms and network conditions when setting this value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:40
Scope: file
Source code excerpt:
FAutoConsoleVariableRef GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecsCVar(
TEXT("n.IpNetDriverMaxFrameTimeBeforeAlert"),
GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs,
TEXT("Time to spend processing networking data in a single frame before an alert is raised (in seconds)\n")
TEXT("It may get called multiple times in a single frame if additional processing after a previous alert exceeds the threshold again\n")
TEXT(" default: 1 s"));
// Time before the time taken in a single frame is printed out (in seconds)
#Associated Variable and Callsites
This variable is associated with another variable named GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:37
Scope: file
Source code excerpt:
// Time before the alarm delegate is called (in seconds)
float GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs = 1.0f;
FAutoConsoleVariableRef GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecsCVar(
TEXT("n.IpNetDriverMaxFrameTimeBeforeAlert"),
GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs,
TEXT("Time to spend processing networking data in a single frame before an alert is raised (in seconds)\n")
TEXT("It may get called multiple times in a single frame if additional processing after a previous alert exceeds the threshold again\n")
TEXT(" default: 1 s"));
// Time before the time taken in a single frame is printed out (in seconds)
float GIpNetDriverLongFramePrintoutThresholdSecs = 10.0f;
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:247
Scope (from outer to inner):
file
class class FPacketIterator
function FPacketIterator
Source code excerpt:
, BailOutTime(InStartReceiveTime + InDriver->MaxSecondsInReceive)
, bSlowFrameChecks(UIpNetDriver::OnNetworkProcessingCausingSlowFrame.IsBound())
, AlarmTime(InStartReceiveTime + GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs)
{
if (!bUseRecvMulti && SocketSubsystem != nullptr)
{
CurrentPacket.Address = SocketSubsystem->CreateInternetAddr();
}
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:378
Scope (from outer to inner):
file
class class FPacketIterator
function void AdvanceCurrentPacket
Source code excerpt:
Driver->OnNetworkProcessingCausingSlowFrame.Broadcast();
AlarmTime = CurrentTime + GIpNetDriverMaxDesiredTimeSliceBeforeAlarmSecs;
}
}
if (bCheckReceiveTime && IterationCount > 0)
{
--NumIterationUntilTimeTest;