tick.LogTicks

tick.LogTicks

#Overview

name: tick.LogTicks

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 tick.LogTicks is to enable or disable logging of ticks for debugging purposes in Unreal Engine 5. This setting variable is primarily used for the engine’s tick system, which is responsible for updating game logic and components at regular intervals.

The Unreal Engine subsystem that relies on this setting variable is the tick system, specifically within the Engine module. This can be seen from the file path Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp.

The value of this variable is set through a console variable (CVar) named CVarLogTicks. It is initialized with a default value of 0, meaning tick logging is disabled by default. Users can change this value at runtime through the console or configuration files.

The CVarLogTicks variable interacts directly with the bLogTicks boolean variable within the FTickTaskSequencer class. At the start of each frame, the value of CVarLogTicks is retrieved and used to set bLogTicks.

Developers should be aware that enabling this variable will cause additional logging output, which can impact performance. It should primarily be used for debugging purposes and not in production builds.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging tick-related issues.
  2. Disable it in production builds to avoid performance overhead.
  3. Use in conjunction with other tick-related debugging tools and variables for comprehensive analysis.

Regarding the associated variable CVarLogTicks:

The purpose of CVarLogTicks is to provide a console-accessible way to control the tick.LogTicks setting. It serves as the actual storage and interface for the tick.LogTicks value.

This variable is part of the Engine module’s tick system, specifically within the TickTaskManager.

The value of CVarLogTicks is set through the console or configuration files. It’s initialized with a default value of 0.

CVarLogTicks directly influences the bLogTicks variable in the FTickTaskSequencer class, which determines whether tick logging is active.

Developers should be aware that changes to CVarLogTicks take effect at the start of the next frame, not immediately.

Best practices for using CVarLogTicks include:

  1. Use it in conjunction with other debugging tools when investigating tick-related issues.
  2. Remember to reset it to 0 after debugging to avoid unnecessary logging overhead.
  3. Consider creating a custom logging category if more detailed tick logging is required for specific game systems.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp:35

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLogTicks(
	TEXT("tick.LogTicks"),
	0,
	TEXT("Spew ticks for debugging."));

static TAutoConsoleVariable<int32> CVarLogTicksShowPrerequistes(
	TEXT("tick.ShowPrerequistes"),
	1,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp:34

Scope: file

Source code excerpt:

	TEXT("Sleep for the given time in start frame. Time is given in ms. This is a debug option used for critical path analysis and forcing a change in the critical path."));

static TAutoConsoleVariable<int32> CVarLogTicks(
	TEXT("tick.LogTicks"),
	0,
	TEXT("Spew ticks for debugging."));

static TAutoConsoleVariable<int32> CVarLogTicksShowPrerequistes(
	TEXT("tick.ShowPrerequistes"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TickTaskManager.cpp:579

Scope (from outer to inner):

file
class        class FTickTaskSequencer
function     void StartFrame

Source code excerpt:

	void StartFrame()
	{
		bLogTicks = !!CVarLogTicks.GetValueOnGameThread();
		bLogTicksShowPrerequistes = !!CVarLogTicksShowPrerequistes.GetValueOnGameThread();

		if (bLogTicks)
		{
			UE_LOG(LogTick, Log, TEXT("tick %6llu ---------------------------------------- Start Frame"),(uint64)GFrameCounter);
		}