csv.ContinuousWrites
csv.ContinuousWrites
#Overview
name: csv.ContinuousWrites
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When 1, completed CSV rows are converted to CSV format strings and appended to the write buffer whilst the capture is in progress.\r\nWhen 0, CSV rows are accumulated in memory as binary data, and only converted to strings and flushed to disk at the end of the capture.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of csv.ContinuousWrites is to control how CSV (Comma-Separated Values) data is written during profiling in Unreal Engine. It determines whether CSV rows are continuously written to disk during the capture process or accumulated in memory and written at the end of the capture.
This setting variable is primarily used by the CSV Profiler subsystem, which is part of the Core module in Unreal Engine. The CSV Profiler is a performance profiling tool used to collect and analyze game performance data.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 1, meaning continuous writes are enabled by default.
The associated variable CVarCsvContinuousWrites directly interacts with csv.ContinuousWrites. They share the same value and purpose, with CVarCsvContinuousWrites being the C++ representation of the console variable.
Developers must be aware that:
- When set to 1 (default), CSV rows are immediately converted to strings and appended to the write buffer during capture.
- When set to 0, CSV rows are stored in memory as binary data and only converted and written to disk at the end of the capture.
Best practices when using this variable include:
- Use continuous writes (value 1) for real-time monitoring and when memory usage is a concern.
- Use end-of-capture writes (value 0) when you want to minimize performance impact during capture, at the cost of higher memory usage.
- Consider the trade-off between real-time data availability and performance impact when choosing the setting.
Regarding the associated variable CVarCsvContinuousWrites:
- It’s the C++ representation of the csv.ContinuousWrites console variable.
- It’s used internally by the CSV Profiler to check the current setting.
- The IsContinuousWriteEnabled function uses this variable to determine whether continuous writes are enabled, with separate checks for game thread and other threads.
- Developers should use the console variable (csv.ContinuousWrites) to change the setting rather than directly modifying CVarCsvContinuousWrites.
#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:89
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarCsvContinuousWrites(
TEXT("csv.ContinuousWrites"),
1,
TEXT("When 1, completed CSV rows are converted to CSV format strings and appended to the write buffer whilst the capture is in progress.\r\n")
TEXT("When 0, CSV rows are accumulated in memory as binary data, and only converted to strings and flushed to disk at the end of the capture."),
ECVF_Default
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarCsvContinuousWrites
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:88
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarCsvContinuousWrites(
TEXT("csv.ContinuousWrites"),
1,
TEXT("When 1, completed CSV rows are converted to CSV format strings and appended to the write buffer whilst the capture is in progress.\r\n")
TEXT("When 0, CSV rows are accumulated in memory as binary data, and only converted to strings and flushed to disk at the end of the capture."),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:371
Scope (from outer to inner):
file
function bool IsContinuousWriteEnabled
Source code excerpt:
#endif
{
CVarValue = bGameThread ? CVarCsvContinuousWrites.GetValueOnGameThread() : CVarCsvContinuousWrites.GetValueOnAnyThread();
}
return CVarValue > 0;
}
#if CSV_PROFILER_ALLOW_DEBUG_FEATURES
class FCsvABTest