r.FASTBuild.JobProcessor.SleepTimeBetweenActions

r.FASTBuild.JobProcessor.SleepTimeBetweenActions

#Overview

name: r.FASTBuild.JobProcessor.SleepTimeBetweenActions

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.FASTBuild.JobProcessor.SleepTimeBetweenActions is to control the sleep time between actions in the FastBuild job processor thread. This setting variable is primarily used in the build system, specifically in the FastBuildController plugin of Unreal Engine 5.

This setting variable is utilized by the FastBuildController plugin, which is part of Unreal Engine’s build system. It’s specifically used in the FFastBuildJobProcessor class, which handles job processing for FastBuild.

The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through the console. Its default value is 0.1 seconds (0.1f).

The associated variable SleepTimeBetweenActions directly interacts with this console variable. They share the same value, and SleepTimeBetweenActions is used in the actual code logic.

Developers must be aware that this variable affects the responsiveness and resource utilization of the FastBuild job processor. A lower value will make the processor check for new tasks more frequently, potentially improving build times but using more CPU. A higher value will reduce CPU usage but might introduce slight delays in processing new tasks.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your build environment and hardware capabilities.
  2. Monitoring build times and CPU usage when modifying this value to find the optimal balance.
  3. Considering the impact on other processes running on the same machine.

Regarding the associated variable SleepTimeBetweenActions:

The purpose of SleepTimeBetweenActions is to store the actual sleep time value used in the FastBuild job processor thread. It’s directly linked to the console variable r.FASTBuild.JobProcessor.SleepTimeBetweenActions.

This variable is used in the FastBuildController plugin, specifically in the FFastBuildJobProcessor::Run function. It determines how long the job processor thread sleeps between actions.

The value of SleepTimeBetweenActions is set by the console variable r.FASTBuild.JobProcessor.SleepTimeBetweenActions. Any changes to the console variable will directly affect this variable.

SleepTimeBetweenActions interacts directly with the FPlatformProcess::Sleep function, controlling the sleep duration of the job processor thread.

Developers should be aware that this variable directly impacts the behavior of the FastBuild job processor. Modifying it will affect how frequently the processor checks for new tasks.

Best practices for using this variable include:

  1. Avoiding direct modification of SleepTimeBetweenActions; instead, use the console variable for changes.
  2. Considering the impact on build performance and system resource usage when adjusting this value.
  3. Testing different values in your specific build environment to find the optimal setting.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/FastBuildController/Source/Private/FastBuildJobProcessor.cpp:13

Scope (from outer to inner):

file
namespace    FastBuildJobProcessorOptions

Source code excerpt:

	float SleepTimeBetweenActions = 0.1f;
	FAutoConsoleVariableRef CVarFASTBuildSleepTimeBetweenActions(
        TEXT("r.FASTBuild.JobProcessor.SleepTimeBetweenActions"),
        SleepTimeBetweenActions,
        TEXT("How much time the job processor thread should sleep between actions .\n"));


	int32 MinJobsToKickOff = 100;
	FAutoConsoleVariableRef CVarFASTBuildShaderMinJobsToKickOff(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/FastBuildController/Source/Private/FastBuildJobProcessor.cpp:11

Scope (from outer to inner):

file
namespace    FastBuildJobProcessorOptions

Source code excerpt:

namespace FastBuildJobProcessorOptions
{
	float SleepTimeBetweenActions = 0.1f;
	FAutoConsoleVariableRef CVarFASTBuildSleepTimeBetweenActions(
        TEXT("r.FASTBuild.JobProcessor.SleepTimeBetweenActions"),
        SleepTimeBetweenActions,
        TEXT("How much time the job processor thread should sleep between actions .\n"));


	int32 MinJobsToKickOff = 100;
	FAutoConsoleVariableRef CVarFASTBuildShaderMinJobsToKickOff(
        TEXT("r.FASTBuild.JobProcessor.MinBatchSize"),

#Loc: <Workspace>/Engine/Plugins/FastBuildController/Source/Private/FastBuildJobProcessor.cpp:89

Scope (from outer to inner):

file
function     uint32 FFastBuildJobProcessor::Run

Source code excerpt:

		}	

		FPlatformProcess::Sleep(FastBuildJobProcessorOptions::SleepTimeBetweenActions);
	}

	bIsWorkDone = true;
	return 0;
}

#Loc: <Workspace>/Engine/Plugins/UbaController/Source/UbaController/Private/UbaJobProcessor.cpp:18

Scope (from outer to inner):

file
namespace    UbaJobProcessorOptions

Source code excerpt:

namespace UbaJobProcessorOptions
{
	static float SleepTimeBetweenActions = 0.01f;
	static FAutoConsoleVariableRef CVarSleepTimeBetweenActions(
        TEXT("r.UbaController.SleepTimeBetweenActions"),
        SleepTimeBetweenActions,
        TEXT("How much time the job processor thread should sleep between actions .\n"));

	static float MaxTimeWithoutTasks = 100.0f;
	static FAutoConsoleVariableRef CVarMaxTimeWithoutTasks(
        TEXT("r.UbaController.MaxTimeWithoutTasks"),
        MaxTimeWithoutTasks,

#Loc: <Workspace>/Engine/Plugins/UbaController/Source/UbaController/Private/UbaJobProcessor.cpp:411

Scope (from outer to inner):

file
function     uint32 FUbaJobProcessor::Run

Source code excerpt:

		lock.Unlock();

		FPlatformProcess::Sleep(UbaJobProcessorOptions::SleepTimeBetweenActions);
	}

	ShutDownUba();

	bIsWorkDone = true;
	return 0;