csv.CompressionMode
csv.CompressionMode
#Overview
name: csv.CompressionMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls whether CSV files are compressed when written out.\r\n -1 = (Default) Use compression if the code which started the capture opted for it.\r\n 0 = Force disable compression. All files will be written as uncompressed .csv files.\r\n 1 = Force enable compression. All files will be written as compressed .csv.gz files.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of csv.CompressionMode is to control the compression of CSV (Comma-Separated Values) files when they are written out by the Unreal Engine’s profiling system, specifically the CSV Profiler.
This setting variable is primarily used by the Unreal Engine’s profiling and debugging subsystem, particularly within the CSV Profiler module. It is part of the Core module of Unreal Engine.
The value of this variable is set through a console variable (CVar) system. It can be set programmatically, through the console, or via command-line arguments. The default value is -1, which means it uses compression if the code that started the capture opted for it.
The csv.CompressionMode variable interacts closely with its associated variable CVarCsvCompressionMode. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable has three possible values: -1: Default behavior, using compression if the capture code opted for it. 0: Force disable compression, resulting in uncompressed .csv files. 1: Force enable compression, resulting in compressed .csv.gz files.
Best practices when using this variable include:
- Consider the trade-off between file size and processing time when deciding on compression.
- Use the default value (-1) unless there’s a specific need to force compression on or off.
- Be consistent in your use of compression across related profiling sessions for easier comparison.
Regarding the associated variable CVarCsvCompressionMode:
- It is the actual console variable that stores the compression mode value.
- It is initialized with the same default value and description as csv.CompressionMode.
- It is used in the FCsvProfiler::BeginFrame function to determine whether to compress the output.
- The variable can be set programmatically in the FCsvProfiler::Init function based on command-line arguments.
When working with CVarCsvCompressionMode, developers should:
- Use the GetValueOnGameThread() method to safely retrieve its value.
- Be aware that changing this value at runtime will affect subsequent CSV file writes.
- Consider the impact on performance and disk space when modifying this value, especially for large-scale profiling sessions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:120
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarCsvCompressionMode(
TEXT("csv.CompressionMode"),
-1,
TEXT("Controls whether CSV files are compressed when written out.\r\n")
TEXT(" -1 = (Default) Use compression if the code which started the capture opted for it.\r\n")
TEXT(" 0 = Force disable compression. All files will be written as uncompressed .csv files.\r\n")
TEXT(" 1 = Force enable compression. All files will be written as compressed .csv.gz files."),
ECVF_Default
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:2975
Scope (from outer to inner):
file
function void FCsvProfiler::BeginFrame
Source code excerpt:
bool bContinuousWrites = IsContinuousWriteEnabled(true);
// Allow overriding of compression based on the "csv.CompressionMode" CVar
bool bCompressOutput;
switch (CVarCsvCompressionMode.GetValueOnGameThread())
{
case 0:
bCompressOutput = false;
break;
#Associated Variable and Callsites
This variable is associated with another variable named CVarCsvCompressionMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:119
Scope: file
Source code excerpt:
#endif
TAutoConsoleVariable<int32> CVarCsvCompressionMode(
TEXT("csv.CompressionMode"),
-1,
TEXT("Controls whether CSV files are compressed when written out.\r\n")
TEXT(" -1 = (Default) Use compression if the code which started the capture opted for it.\r\n")
TEXT(" 0 = Force disable compression. All files will be written as uncompressed .csv files.\r\n")
TEXT(" 1 = Force enable compression. All files will be written as compressed .csv.gz files."),
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:2977
Scope (from outer to inner):
file
function void FCsvProfiler::BeginFrame
Source code excerpt:
// Allow overriding of compression based on the "csv.CompressionMode" CVar
bool bCompressOutput;
switch (CVarCsvCompressionMode.GetValueOnGameThread())
{
case 0:
bCompressOutput = false;
break;
case 1:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:3885
Scope (from outer to inner):
file
function void FCsvProfiler::Init
Source code excerpt:
switch (CompressionMode)
{
case 0: CVarCsvCompressionMode->Set(0); break;
case 1: CVarCsvCompressionMode->Set(1); break;
default:
UE_LOG(LogCsvProfiler, Warning, TEXT("Invalid command line compression mode \"%d\"."), CompressionMode);
break;
}
}
GCsvABTest.InitFromCommandline();