r.Streaming.StressTest.ExtraAsyncLatency
r.Streaming.StressTest.ExtraAsyncLatency
#Overview
name: r.Streaming.StressTest.ExtraAsyncLatency
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
An extra latency in milliseconds for each async task when doing the stress test.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.StressTest.ExtraAsyncLatency is to introduce artificial latency for stress testing the streaming system in Unreal Engine 5. This setting variable is specifically designed for the rendering asset streaming subsystem.
The Unreal Engine subsystem that relies on this setting variable is the rendering asset streaming system, particularly within the Engine module. This can be seen from the file path Engine/Source/Runtime/Engine/Private/Streaming/RenderAssetUpdate.cpp
.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning no extra latency by default.
This variable interacts with its associated variable CVarStreamingStressTestExtraAsyncLatency. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable is intended for stress testing and debugging purposes only. It’s marked with ECVF_Cheat flag, indicating it shouldn’t be used in shipping builds. The variable adds artificial latency to each async task in the streaming system, which can significantly impact performance.
Best practices when using this variable include:
- Only use it for stress testing and debugging purposes.
- Be cautious with high values as they can severely impact performance.
- Remember to reset it to 0 after testing to avoid unintended performance issues.
- Use it in conjunction with other streaming stress test tools for comprehensive testing.
Regarding the associated variable CVarStreamingStressTestExtraAsyncLatency:
The purpose of CVarStreamingStressTestExtraAsyncLatency is the same as r.Streaming.StressTest.ExtraAsyncLatency. It’s used to control the extra latency added to async tasks during stress testing of the streaming system.
This variable is used directly in the FRenderAssetUpdate::FMipUpdateTask::DoWork() function to add the specified latency. The latency is applied only in non-shipping builds, as indicated by the #if !UE_BUILD_SHIPPING preprocessor directive.
The value of this variable is retrieved using the GetValueOnAnyThread() method, suggesting it can be accessed from multiple threads safely.
Developers should be aware that this variable directly affects the execution time of async tasks in the streaming system. It’s crucial to use it judiciously and only for its intended purpose of stress testing.
Best practices for using CVarStreamingStressTestExtraAsyncLatency align with those of r.Streaming.StressTest.ExtraAsyncLatency, as they are essentially the same variable. Additionally, developers should consider the impact on multi-threaded performance when adjusting this value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/RenderAssetUpdate.cpp:19
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarStreamingStressTestExtraAsyncLatency(
TEXT("r.Streaming.StressTest.ExtraAsyncLatency"),
0,
TEXT("An extra latency in milliseconds for each async task when doing the stress test."),
ECVF_Cheat);
volatile int32 GRenderAssetStreamingSuspension = 0;
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingStressTestExtraAsyncLatency
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/RenderAssetUpdate.cpp:18
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarStreamingStressTestExtraAsyncLatency(
TEXT("r.Streaming.StressTest.ExtraAsyncLatency"),
0,
TEXT("An extra latency in milliseconds for each async task when doing the stress test."),
ECVF_Cheat);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/RenderAssetUpdate.cpp:293
Scope (from outer to inner):
file
function void FRenderAssetUpdate::FMipUpdateTask::DoWork
Source code excerpt:
#if !UE_BUILD_SHIPPING
const int32 ExtraSyncLatency = CVarStreamingStressTestExtraAsyncLatency.GetValueOnAnyThread();
if (ExtraSyncLatency > 0)
{
// Slow down the async. Used to test GC issues.
FPlatformProcess::Sleep(ExtraSyncLatency * .001f);
}
#endif