csv.PauseProcessingThread
csv.PauseProcessingThread
#Overview
name: csv.PauseProcessingThread
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Debug only - When 1, blocks the processing thread to simulate starvation
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of csv.PauseProcessingThread is to provide a debug mechanism for simulating starvation in the CSV (Comma-Separated Values) profiler’s processing thread. It is primarily used for testing and debugging purposes within the Unreal Engine’s profiling and debugging subsystem.
This setting variable is relied upon by the Core module of Unreal Engine, specifically within the CSV profiler system. The CSV profiler is part of Unreal Engine’s performance analysis tools, used for capturing and analyzing performance data.
The value of this variable is set through the TAutoConsoleVariable mechanism, which allows it to be changed at runtime via console commands. Its default value is 0, meaning the processing thread is not paused by default.
The associated variable CVarCsvPauseProcessingThread directly interacts with csv.PauseProcessingThread. They share the same value and purpose.
Developers must be aware that enabling this variable (setting it to 1) will block the CSV profiler’s processing thread, simulating a starvation scenario. This can significantly impact the performance and behavior of the profiling system, and should only be used for specific debugging purposes.
Best practices when using this variable include:
- Only enable it when specifically debugging issues related to the CSV profiler’s processing thread.
- Remember to disable it after debugging to avoid unintended performance impacts.
- Use it in conjunction with other profiling tools to get a comprehensive view of the system’s behavior under simulated starvation conditions.
Regarding the associated variable CVarCsvPauseProcessingThread:
The purpose of CVarCsvPauseProcessingThread is identical to csv.PauseProcessingThread. It’s an internal representation of the console variable within the C++ code.
This variable is used directly in the FCsvProfilerProcessingThread class, specifically in its Run() method. When the variable is set to a non-zero value, it causes the processing thread to sleep, effectively pausing its execution.
The value of CVarCsvPauseProcessingThread is set and accessed using the TAutoConsoleVariable mechanism, allowing for runtime changes via console commands.
Developers should be aware that this variable is checked in a loop within the processing thread, so changes to its value will take effect quickly.
Best practices for using CVarCsvPauseProcessingThread are the same as for csv.PauseProcessingThread, as they represent the same functionality. It’s crucial to use this variable judiciously and only for its intended debugging purposes to avoid unintended impacts on the profiling system’s performance and accuracy.
#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:152
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarCsvPauseProcessingThread(
TEXT("csv.PauseProcessingThread"),
0,
TEXT("Debug only - When 1, blocks the processing thread to simulate starvation"),
ECVF_Default
);
TAutoConsoleVariable<int32> CVarMaxPerThreadStatDataSlackKB(
#Associated Variable and Callsites
This variable is associated with another variable named CVarCsvPauseProcessingThread
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:151
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarCsvPauseProcessingThread(
TEXT("csv.PauseProcessingThread"),
0,
TEXT("Debug only - When 1, blocks the processing thread to simulate starvation"),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/ProfilingDebugging/CsvProfiler.cpp:2579
Scope (from outer to inner):
file
class class FCsvProfilerProcessingThread : public FRunnable
function virtual uint32 Run
Source code excerpt:
while (StopCounter.GetValue() == 0)
{
if (CVarCsvPauseProcessingThread.GetValueOnAnyThread())
{
FPlatformProcess::Sleep(TimeBetweenUpdatesMS / 1000.0f);
continue;
}
float ElapsedMS = CsvProfiler.ProcessStatData();