net.PingDisplayServerTime
net.PingDisplayServerTime
#Overview
name: net.PingDisplayServerTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Show server frame time. Not available in shipping builds.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.PingDisplayServerTime is to enable the display of server frame time in non-shipping builds of Unreal Engine. This setting is primarily used for debugging and performance monitoring of the networking system.
This setting variable is utilized by the networking subsystem of Unreal Engine, specifically within the NetConnection module. It’s referenced in the Engine/Source/Runtime/Engine/Private/NetConnection.cpp file, which handles network connections and packet processing.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.
The associated variable CVarPingDisplayServerTime directly interacts with net.PingDisplayServerTime. They share the same value and purpose.
Developers must be aware of several important points when using this variable:
- It’s only available in non-shipping builds (#if !UE_BUILD_SHIPPING).
- When enabled (set to a value greater than 0), it will log the server frame time for each packet received.
- The logging occurs in the ReadPacketInfo function of the UNetConnection class.
- The server frame time is displayed in milliseconds.
Best practices for using this variable include:
- Only enable it when necessary for debugging or performance analysis, as it can impact performance due to additional logging.
- Remember to disable it before creating shipping builds, as it’s not available in those builds.
- Use in conjunction with other networking diagnostic tools for a comprehensive understanding of network performance.
Regarding the associated variable CVarPingDisplayServerTime: The purpose of CVarPingDisplayServerTime is identical to net.PingDisplayServerTime. It’s the C++ variable that directly controls the behavior specified by the console variable.
This variable is used within the networking subsystem, specifically in the packet reading process of UNetConnection.
Its value is set through the TAutoConsoleVariable system, initialized to 0.
CVarPingDisplayServerTime interacts directly with the net.PingDisplayServerTime console variable. When the console variable is changed, this C++ variable’s value is updated accordingly.
Developers should be aware that this variable is checked on every packet read, so frequent changes to its value during runtime may have performance implications.
Best practices for CVarPingDisplayServerTime align with those of net.PingDisplayServerTime. Additionally, developers working directly with the C++ code should use CVarPingDisplayServerTime.GetValueOnAnyThread() to access its current value in a thread-safe manner.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetConnection.cpp:63
Scope: file
Source code excerpt:
#if !UE_BUILD_SHIPPING
static TAutoConsoleVariable<int32> CVarPingDisplayServerTime(TEXT("net.PingDisplayServerTime"), 0,
TEXT("Show server frame time. Not available in shipping builds."));
#endif
static TAutoConsoleVariable<int32> CVarTickAllOpenChannels(TEXT("net.TickAllOpenChannels"), 0,
TEXT("If nonzero, each net connection will tick all of its open channels every tick. Leaving this off will improve performance."));
#Associated Variable and Callsites
This variable is associated with another variable named CVarPingDisplayServerTime
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetConnection.cpp:63
Scope: file
Source code excerpt:
#if !UE_BUILD_SHIPPING
static TAutoConsoleVariable<int32> CVarPingDisplayServerTime(TEXT("net.PingDisplayServerTime"), 0,
TEXT("Show server frame time. Not available in shipping builds."));
#endif
static TAutoConsoleVariable<int32> CVarTickAllOpenChannels(TEXT("net.TickAllOpenChannels"), 0,
TEXT("If nonzero, each net connection will tick all of its open channels every tick. Leaving this off will improve performance."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetConnection.cpp:2703
Scope (from outer to inner):
file
function bool UNetConnection::ReadPacketInfo
Source code excerpt:
#if !UE_BUILD_SHIPPING
if ( CVarPingDisplayServerTime.GetValueOnAnyThread() > 0 )
{
UE_LOG( LogNetTraffic, Warning, TEXT( "ServerFrameTime: %2.2f" ), ServerFrameTime * 1000.0f );
}
#endif
double PacketReceiveTime = 0.0;