TrackAsyncLoadRequests.StackLen
TrackAsyncLoadRequests.StackLen
#Overview
name: TrackAsyncLoadRequests.StackLen
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum number of stack frame items to keep. This improves aggregation because calls that originate from multiple places but end up in the same place will be accounted together.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of TrackAsyncLoadRequests.StackLen is to control the maximum number of stack frame items to keep when tracking async load requests in Unreal Engine 5. This setting is primarily used for debugging and profiling purposes within the asset loading system.
This setting variable is utilized in the CoreUObject module, specifically within the AsyncPackageLoader subsystem. It’s part of the asset loading and serialization process, which is crucial for managing game assets efficiently.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 12, but can be modified at runtime through console commands or configuration files.
TrackAsyncLoadRequests.StackLen interacts closely with other related variables such as TrackAsyncLoadRequests.StackIgnore and TrackAsyncLoadRequests.Dedupe. These variables work together to fine-tune the stack trace capturing process for async load requests.
Developers should be aware that this variable affects the granularity of stack trace information captured during async load requests. A higher value will provide more detailed stack information but may consume more memory and potentially impact performance if set too high.
Best practices when using this variable include:
- Keeping the value reasonably low (the default of 12 is often sufficient) unless detailed debugging is required.
- Adjusting it in conjunction with other related variables for optimal tracking.
- Being mindful of potential performance impacts when increasing the value significantly.
Regarding the associated variable CVarTrackAsyncLoadRequests_StackLen:
This is the actual console variable object that controls the TrackAsyncLoadRequests.StackLen setting. It’s defined using the TAutoConsoleVariable template, which allows for runtime modification of the value.
The purpose of CVarTrackAsyncLoadRequests_StackLen is to provide a programmatic interface to get and set the TrackAsyncLoadRequests.StackLen value within the engine’s code.
This variable is used directly in the AsyncPackageLoader when capturing stack traces for async load requests. It’s accessed using the GetInt() method to retrieve the current value when needed.
Developers should be aware that modifying this variable directly in code is generally not necessary, as it’s designed to be controlled through the console variable system. However, they can use it to read the current value if needed in related systems.
Best practices for CVarTrackAsyncLoadRequests_StackLen include:
- Using it for read-only purposes in most cases, relying on the console variable system for modifications.
- Considering its value when implementing or modifying systems related to async asset loading and debugging.
- Documenting any code that relies on or modifies this variable to ensure maintainability.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncPackageLoader.cpp:375
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_StackLen(
TEXT("TrackAsyncLoadRequests.StackLen"),
12,
TEXT("Maximum number of stack frame items to keep. This improves aggregation because calls that originate from multiple places but end up in the same place will be accounted together."));
static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Threshhold(
TEXT("TrackAsyncLoadRequests.Threshhold"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarTrackAsyncLoadRequests_StackLen
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncPackageLoader.cpp:374
Scope: file
Source code excerpt:
TEXT("Number of items to discard from the top of a stack frame."));
static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_StackLen(
TEXT("TrackAsyncLoadRequests.StackLen"),
12,
TEXT("Maximum number of stack frame items to keep. This improves aggregation because calls that originate from multiple places but end up in the same place will be accounted together."));
static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Threshhold(
TEXT("TrackAsyncLoadRequests.Threshhold"),
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncPackageLoader.cpp:483
Scope (from outer to inner):
file
function void TrackRequest
Source code excerpt:
FScopeLock Lock(&CritSec);
StackTracker.CaptureStackTrace(CVarTrackAsyncLoadRequests_StackIgnore->GetInt(), (void*)UserData, CVarTrackAsyncLoadRequests_StackLen->GetInt(), CVarTrackAsyncLoadRequests_Dedupe->GetBool());
}
void Reset()
{
FScopeLock Lock(&CritSec);
StackTracker.ResetTracking();