au.LogRenderTimes

au.LogRenderTimes

#Overview

name: au.LogRenderTimes

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 au.LogRenderTimes is to enable logging of audio render times in Unreal Engine’s audio mixer system. This setting variable is used to control the verbosity of audio rendering performance logs.

This setting variable is primarily used in the Audio Mixer Core subsystem of Unreal Engine. It’s specifically referenced in the AudioMixer.cpp file, which is part of the audio rendering pipeline.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0 and can be changed at runtime using console commands or through configuration files.

The au.LogRenderTimes variable interacts directly with the LogRenderTimesCVar variable. They share the same value, with LogRenderTimesCVar being the actual integer variable used in the code logic.

Developers should be aware that enabling this logging (by setting the value to 1) may have a performance impact, especially in performance-critical scenarios. It should primarily be used for debugging and performance analysis purposes.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging or performance analysis.
  2. Remember to disable it in production builds to avoid unnecessary performance overhead.
  3. Use in conjunction with other audio debugging tools for a comprehensive understanding of audio rendering performance.

Regarding the associated variable LogRenderTimesCVar:

The purpose of LogRenderTimesCVar is to serve as the actual integer variable that controls the logging behavior within the C++ code.

It’s used directly in the audio mixer core module to determine whether to log render times or not.

The value of LogRenderTimesCVar is set through the au.LogRenderTimes console variable.

It interacts directly with the au.LogRenderTimes CVar and is used in conditional statements to control logging behavior.

Developers should be aware that this variable is the one actually checked in the code logic, so any changes to au.LogRenderTimes will be reflected in LogRenderTimesCVar.

Best practices include:

  1. Avoid modifying LogRenderTimesCVar directly; instead, use the au.LogRenderTimes console variable to control its value.
  2. When debugging audio render times, check both au.LogRenderTimes and LogRenderTimesCVar to ensure they have the expected values.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:32

Scope: file

Source code excerpt:

static int32 LogRenderTimesCVar = 0;
FAutoConsoleVariableRef CVarLogRenderTimes(
	TEXT("au.LogRenderTimes"),
	LogRenderTimesCVar,
	TEXT("Logs Audio Render Times.\n")
	TEXT("0: Not Log, 1: Log"),
	ECVF_Default);

static float MinTimeBetweenUnderrunWarningsMs = 1000.f*10.f;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:30

Scope: file

Source code excerpt:


// Command to enable logging to display accurate audio render times
static int32 LogRenderTimesCVar = 0;
FAutoConsoleVariableRef CVarLogRenderTimes(
	TEXT("au.LogRenderTimes"),
	LogRenderTimesCVar,
	TEXT("Logs Audio Render Times.\n")
	TEXT("0: Not Log, 1: Log"),
	ECVF_Default);

static float MinTimeBetweenUnderrunWarningsMs = 1000.f*10.f;
FAutoConsoleVariableRef CVarMinTimeBetweenUnderrunWarningsMs(

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:184

Scope (from outer to inner):

file
namespace    Audio
function     void FAudioRenderTimeAnalysis::End

Source code excerpt:

		}

		if (LogRenderTimesCVar == 1)
		{
			if (RenderTimeCount % 32 == 0)
			{
				RenderTimeSinceLastLog /= 32.0f;
				UE_LOG(LogAudioMixerDebug, Display, TEXT("Render Time [id:%d] - Max: %.2f ms, MaxDelta: %.2f ms, Delta Avg: %.2f ms, Global Avg: %.2f ms"), 
					RenderInstanceId,