csv.AlwaysShowFrameCount

csv.AlwaysShowFrameCount

#Overview

name: csv.AlwaysShowFrameCount

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 csv.AlwaysShowFrameCount is to control the display of frame count information in non-shipping builds of Unreal Engine, even when screen messages are disabled. This setting is primarily used for debugging and profiling purposes.

This setting variable is utilized by the Engine module, specifically within the UnrealEngine.cpp file. It’s part of the engine’s debugging and profiling system, particularly related to the CSV (Comma Separated Values) profiler.

The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with a default value of false. This means that by default, the frame count is not shown when screen messages are disabled.

The associated variable CVarCsvAlwaysShowFrameCount directly interacts with csv.AlwaysShowFrameCount. They share the same value and purpose. CVarCsvAlwaysShowFrameCount is the C++ representation of the console variable that can be accessed in the code.

Developers must be aware that this variable only affects non-shipping builds (#if !UE_BUILD_SHIPPING). It won’t have any effect in shipping builds of the game. Also, it’s specifically designed to work in conjunction with the CSV profiler system.

Best practices when using this variable include:

  1. Use it primarily for debugging and profiling purposes.
  2. Be aware that enabling it may have a slight performance impact due to the additional rendering of frame count information.
  3. Remember to disable it before creating shipping builds to avoid any unnecessary overhead.

Regarding the associated variable CVarCsvAlwaysShowFrameCount:

The purpose of CVarCsvAlwaysShowFrameCount is to provide programmatic access to the csv.AlwaysShowFrameCount setting within the C++ code. It allows developers to check the current state of the setting and act accordingly.

This variable is used in the Engine module, specifically in the DrawStatsHUD function of UnrealEngine.cpp. It’s part of the engine’s debugging and profiling system, working in tandem with the CSV profiler.

The value of CVarCsvAlwaysShowFrameCount is set when the csv.AlwaysShowFrameCount console variable is set. It can be accessed in the code using the GetValueOnGameThread() method.

CVarCsvAlwaysShowFrameCount interacts directly with the CSV profiler system. It’s used to determine whether to display frame count information when the CSV profiler is active.

Developers should be aware that this variable is only available in non-shipping builds and is specifically tied to the CSV profiler functionality.

Best practices for using CVarCsvAlwaysShowFrameCount include:

  1. Use GetValueOnGameThread() to safely access its value from game thread code.
  2. Consider the performance implications of frequently checking this value in performance-critical code paths.
  3. Use it in conjunction with other CSV profiler-related functionality for comprehensive debugging and profiling.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:487

Scope: file

Source code excerpt:

#if !UE_BUILD_SHIPPING
TAutoConsoleVariable<bool> CVarCsvAlwaysShowFrameCount(
	TEXT("csv.AlwaysShowFrameCount"),
	false,
	TEXT("If enabled, we show the frame count in non-shipping builds, even if screen messages are disabled")
);
#endif

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:486

Scope: file

Source code excerpt:


#if !UE_BUILD_SHIPPING
TAutoConsoleVariable<bool> CVarCsvAlwaysShowFrameCount(
	TEXT("csv.AlwaysShowFrameCount"),
	false,
	TEXT("If enabled, we show the frame count in non-shipping builds, even if screen messages are disabled")
);
#endif

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:12670

Scope (from outer to inner):

file
function     void DrawStatsHUD

Source code excerpt:


#if CSV_PROFILER
	if ( ( bShowScreenMessages || CVarCsvAlwaysShowFrameCount.GetValueOnGameThread() ) && ( FCsvProfiler::Get()->IsCapturing() || FCsvProfiler::Get()->IsWritingFile() ) )
	{
		if (FCsvProfiler::Get()->IsWritingFile())
		{
			SmallTextItem.SetColor(FLinearColor(1.0f, 0.0f, 0.0f, 1.0f));
			SmallTextItem.Text = FText::Format(LOCTEXT("CsvProfilerWriteFmt", "CsvProfiler, please wait, writing file... Total frames: {0}"), FCsvProfiler::Get()->GetCaptureFrameNumber());
		}