TrackAsyncLoadRequests.Dedupe

TrackAsyncLoadRequests.Dedupe

#Overview

name: TrackAsyncLoadRequests.Dedupe

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TrackAsyncLoadRequests.Dedupe is to control the deduplication of requests for asynchronous package loading in Unreal Engine’s reporting system.

This setting variable is primarily used in the CoreUObject module, specifically within the AsyncPackageLoader subsystem. It affects how the engine reports and tracks asynchronous loading requests for packages.

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, which means deduplication is disabled by default.

The associated variable CVarTrackAsyncLoadRequests_Dedupe directly interacts with TrackAsyncLoadRequests.Dedupe. They share the same value and purpose.

Developers must be aware that:

  1. This variable is used for debugging and profiling purposes, not for runtime gameplay behavior.
  2. When enabled (value > 0), it affects the output of async load request reports by deduplicating requests for the same package.
  3. It’s part of a larger system for tracking async load requests, working alongside other variables like CVarTrackAsyncLoadRequests_RemoveAliases and CVarTrackAsyncLoadRequests_StackIgnore.

Best practices when using this variable include:

  1. Enable it (set to 1) when investigating issues related to redundant async loading requests.
  2. Use it in conjunction with other TrackAsyncLoadRequests variables for comprehensive async loading analysis.
  3. Keep it disabled (0) in production builds to avoid unnecessary overhead.

Regarding the associated variable CVarTrackAsyncLoadRequests_Dedupe:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Dedupe(
	TEXT("TrackAsyncLoadRequests.Dedupe"),
	0,
	TEXT("If > 0 then deduplicate requests to async load the same package in the report.")
);

static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_RemoveAliases(
	TEXT("TrackAsyncLoadRequests.RemoveAliases"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_Dedupe(
	TEXT("TrackAsyncLoadRequests.Dedupe"),
	0,
	TEXT("If > 0 then deduplicate requests to async load the same package in the report.")
);

static TAutoConsoleVariable<int32> CVarTrackAsyncLoadRequests_RemoveAliases(

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

Scope (from outer to inner):

file
function     static void ReportStack

Source code excerpt:

		Ar.SetSuppressEventTag(true);

		if (CVarTrackAsyncLoadRequests_Dedupe->GetInt() > 0)
		{
			Ar.Logf(TEXT("Requested package names (Deduped):"));
			Ar.Logf(TEXT("===================="));
			TSet<FString> Seen;
			for (auto& Request : UserData->Requests)
			{

#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();