You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespaceUnrealBuildTool
{
classActionThread
{
// ...
public overrideboolExecuteActions(List<Action> Actions)
{
// Time to sleep after each iteration of the loop in order to not busy wait.constfloat LoopSleepTime = 0.1f;
// Use WMI to figure out physical cores, excluding hyper threading.int NumCores = Utils.GetPhysicalProcessorCount();
if (NumCores == -1)
{
NumCores = System.Environment.ProcessorCount;
}
// The number of actions to execute in parallel is trying to keep the CPU busy enough in presence of I/O stalls.int MaxActionsToExecuteInParallel = 0;
if (NumCores < System.Environment.ProcessorCount && BuildConfiguration.ProcessorCountMultiplier != 1.0)
{
// The CPU has more logical cores than physical ones, aka uses hyper-threading. // Use multiplier if provided
MaxActionsToExecuteInParallel = (int)(NumCores * BuildConfiguration.ProcessorCountMultiplier);
}
elseif (NumCores < System.Environment.ProcessorCount && NumCores > 4)
{
// The CPU has more logical cores than physical ones, aka uses hyper-threading. // Use average of logical and physical if we have "lots of cores"
MaxActionsToExecuteInParallel = (int)(NumCores + System.Environment.ProcessorCount) / 2;
}
// No hyper-threading. Only kicking off a task per CPU to keep machine responsive.else
{
MaxActionsToExecuteInParallel = NumCores;
}
// ...
}
}
}