fx.DetailedCSVStats

fx.DetailedCSVStats

#Overview

name: fx.DetailedCSVStats

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 fx.DetailedCSVStats is to control the collection and output of detailed particle system performance statistics to the CSV profiler in Unreal Engine 5. This setting is primarily used for performance analysis and debugging of particle systems and GPU-based effects.

This setting variable is relied upon by the following Unreal Engine subsystems and modules:

  1. The core Engine module, specifically in the particle system performance tracking code.
  2. The Niagara plugin, which is Unreal Engine’s advanced VFX system.

The value of this variable is set through a console variable (CVar) declaration in the Engine module. It’s initialized as false by default, meaning detailed CSV stats are not collected unless explicitly enabled.

This variable interacts with other performance tracking and profiling systems in Unreal Engine, particularly:

  1. The CSV profiler system
  2. The Niagara GPU profiler
  3. The particle performance statistics tracking system

Developers must be aware of the following when using this variable:

  1. Enabling this variable may have a performance impact, as it increases the amount of data collected and written to the CSV profiler.
  2. It’s primarily intended for debugging and performance analysis, not for use in shipping builds.
  3. The variable is marked as render thread safe, meaning it can be changed at runtime without causing thread safety issues.

Best practices when using this variable include:

  1. Only enable it when necessary for performance analysis or debugging.
  2. Be mindful of the potential performance overhead when enabled, especially in complex scenes with many particle systems.
  3. Use it in conjunction with other profiling tools to get a comprehensive view of performance.
  4. Remember to disable it before creating shipping builds to avoid unnecessary overhead.
  5. When analyzing the resulting CSV data, correlate the particle system performance with other engine subsystems for a holistic understanding of performance bottlenecks.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticlePerfStats.cpp:1110

Scope: file

Source code excerpt:


static FAutoConsoleVariable CVarWriteDetailedCSVStats(
	TEXT("fx.DetailedCSVStats"),
	false,
	TEXT("If true, we write detailed partilce stats to the CSV profiler."),
	FConsoleVariableDelegate::CreateStatic(&OnDetailedCSVStatsEnabledChanged),
	ECVF_Default | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraGPUProfiler.cpp:50

Scope (from outer to inner):

file
function     void FNiagaraGPUProfiler::BeginFrame

Source code excerpt:


	// If we are not enabled nothing to profile
	static const auto CSVStatsEnabledCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("fx.DetailedCSVStats"));
	const bool bCsvCollecting = CSVStatsEnabledCVar && CSVStatsEnabledCVar->GetBool();
	if ( !GNiagaraGpuProfilingEnabled || ((NumReaders == 0) && !bCsvCollecting) )
	{
		return;
	}

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraGpuComputeDispatch.cpp:160

Scope (from outer to inner):

file
namespace    FNiagaraGpuComputeDispatchLocal
function     static bool CsvStatsEnabled

Source code excerpt:

	{
	#if WITH_PARTICLE_PERF_CSV_STATS
		static IConsoleVariable* DetailedCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("fx.DetailedCSVStats"));
		return DetailedCVar && DetailedCVar->GetBool();
	#else
		return false;
	#endif
	}
}