TrackAsyncLoadRequests.Enable

TrackAsyncLoadRequests.Enable

#Overview

name: TrackAsyncLoadRequests.Enable

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TrackAsyncLoadRequests.Enable is to control the tracking of asynchronous load requests in Unreal Engine’s asset loading system. This setting variable is primarily used for debugging and performance analysis of the asset loading process.

This setting variable is utilized by the CoreUObject module, specifically within the AsyncPackageLoader subsystem. It’s part of the engine’s asset streaming and loading infrastructure.

The value of this variable is set through a console variable (CVar) system, which allows runtime configuration. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.

TrackAsyncLoadRequests.Enable interacts directly with its associated variable CVarTrackAsyncLoadRequests_Enable. They share the same value and purpose. Additionally, it’s used in conjunction with another console variable, CVarTrackAsyncLoadRequests_Dedupe, which is related to deduplication in the tracking process.

Developers must be aware that enabling this variable (setting it to a value greater than 0) will impact performance. As the comment suggests, it “removes aliases from the counting process” and “merges addresses that have the same human readable string,” which can slow down the asset loading process.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging or performance analysis.
  2. Be mindful of the performance impact when enabled.
  3. Use it in conjunction with other asset loading diagnostics tools for a comprehensive understanding of the loading process.

Regarding the associated variable CVarTrackAsyncLoadRequests_Enable:

The purpose of CVarTrackAsyncLoadRequests_Enable is identical to TrackAsyncLoadRequests.Enable. It’s the actual console variable implementation that controls the tracking of asynchronous load requests.

This variable is used directly in the AsyncPackageLoader’s TrackRequest function to determine whether tracking should occur. If the value is 0, the tracking is skipped entirely.

The value of this variable is set through the console variable system, allowing for runtime configuration.

CVarTrackAsyncLoadRequests_Enable interacts closely with the TrackAsyncLoadRequests.Enable setting, as they represent the same configuration option. It’s also used in conjunction with other tracking-related variables in the AsyncPackageLoader.

Developers should be aware that this variable directly controls the execution of tracking code. Enabling it (setting to a non-zero value) will introduce additional processing overhead during asset loading.

Best practices for using CVarTrackAsyncLoadRequests_Enable include:

  1. Use it for temporary debugging or profiling sessions, not in production builds.
  2. Combine its use with appropriate logging or profiling tools to capture the tracked data.
  3. Remember to disable it (set to 0) when the debugging or profiling session is complete to restore normal performance.

#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:352

Scope: file

Source code excerpt:

#if DO_TRACK_ASYNC_LOAD_REQUESTS
static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Enable(
	TEXT("TrackAsyncLoadRequests.Enable"),
	0,
	TEXT("If > 0 then remove aliases from the counting process. This essentialy merges addresses that have the same human readable string. It is slower.")
);

static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Dedupe(
	TEXT("TrackAsyncLoadRequests.Dedupe"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarTrackAsyncLoadRequests_Enable. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncPackageLoader.cpp:351

Scope: file

Source code excerpt:


#if DO_TRACK_ASYNC_LOAD_REQUESTS
static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Enable(
	TEXT("TrackAsyncLoadRequests.Enable"),
	0,
	TEXT("If > 0 then remove aliases from the counting process. This essentialy merges addresses that have the same human readable string. It is slower.")
);

static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Dedupe(

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncPackageLoader.cpp:474

Scope (from outer to inner):

file
function     void TrackRequest

Source code excerpt:

	void TrackRequest(const FString& InName, const TCHAR* InPackageToLoadFrom, int32 InPriority)
	{
		if (CVarTrackAsyncLoadRequests_Enable->GetInt() == 0)
		{
			return;
		}

		FUserData* UserData = new FUserData;
		UserData->Requests.Emplace(InPackageToLoadFrom ? FString(InPackageToLoadFrom) : InName, InPriority);