p.gc.logcachereduction
p.gc.logcachereduction
#Overview
name: p.gc.logcachereduction
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Logs amount of data removed from a cache after processing
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.gc.logcachereduction is to control logging of data reduction in the geometry collection cache system. It is used to track and report the amount of data removed from a cache after processing.
This setting variable is primarily used in the Experimental Chaos module of Unreal Engine, specifically within the geometry collection subsystem. It’s referenced in the RecordedTransformTrack.cpp file, which deals with recording and processing transform data for geometry collections.
The value of this variable is set through a console command. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning the logging is disabled by default.
The associated variable CVarLogCacheReduction directly interacts with p.gc.logcachereduction. It’s the C++ representation of the console variable and is used to access the current value of the setting.
Developers must be aware that enabling this logging might impact performance, especially in debug builds or when processing large geometry collections. It should primarily be used for debugging and optimization purposes.
Best practices when using this variable include:
- Only enable it when necessary for debugging or performance analysis.
- Remember to disable it in production builds to avoid unnecessary overhead.
- Use it in conjunction with other profiling tools to get a comprehensive view of geometry collection cache performance.
Regarding the associated variable CVarLogCacheReduction:
The purpose of CVarLogCacheReduction is to provide a programmatic way to access the value of p.gc.logcachereduction within the C++ code.
It’s used in the Experimental Chaos module, specifically in the geometry collection cache processing logic.
The value of CVarLogCacheReduction is set automatically based on the console variable p.gc.logcachereduction.
This variable interacts directly with the console command p.gc.logcachereduction, reflecting its current value.
Developers should be aware that CVarLogCacheReduction.GetValueOnAnyThread() is used to check the current state of the logging setting. This method is thread-safe and can be called from any thread.
Best practices for using CVarLogCacheReduction include:
- Use GetValueOnAnyThread() when accessing the value to ensure thread safety.
- Consider caching the value if it’s accessed frequently in performance-critical code.
- Be mindful of the performance impact when the logging is enabled, especially in tight loops or frequently called functions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/GeometryCollection/RecordedTransformTrack.cpp:6
Scope: file
Source code excerpt:
DEFINE_LOG_CATEGORY_STATIC(LogGeometryCollectionCache, Log, All);
TAutoConsoleVariable<int32> CVarLogCacheReduction(TEXT("p.gc.logcachereduction"), 0, TEXT("Logs amount of data removed from a cache after processing"));
FRecordedTransformTrack FRecordedTransformTrack::ProcessRawRecordedData(const FRecordedTransformTrack& InCache)
{
FRecordedTransformTrack RecordedData = InCache;
#Associated Variable and Callsites
This variable is associated with another variable named CVarLogCacheReduction
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/GeometryCollection/RecordedTransformTrack.cpp:6
Scope: file
Source code excerpt:
DEFINE_LOG_CATEGORY_STATIC(LogGeometryCollectionCache, Log, All);
TAutoConsoleVariable<int32> CVarLogCacheReduction(TEXT("p.gc.logcachereduction"), 0, TEXT("Logs amount of data removed from a cache after processing"));
FRecordedTransformTrack FRecordedTransformTrack::ProcessRawRecordedData(const FRecordedTransformTrack& InCache)
{
FRecordedTransformTrack RecordedData = InCache;
FArchiveCountMem BeforeAr(nullptr);
if (CVarLogCacheReduction.GetValueOnAnyThread() != 0)
{
UScriptStruct* RecordedTrackStructType = FRecordedTransformTrack::StaticStruct();
RecordedTrackStructType->SerializeTaggedProperties(BeforeAr, (uint8*)&RecordedData, RecordedTrackStructType, nullptr);
}
int32 NumRemovedParticles = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/GeometryCollection/RecordedTransformTrack.cpp:93
Scope (from outer to inner):
file
function FRecordedTransformTrack FRecordedTransformTrack::ProcessRawRecordedData
Source code excerpt:
FArchiveCountMem AfterAr(nullptr);
if (CVarLogCacheReduction.GetValueOnAnyThread() != 0)
{
UScriptStruct* RecordedTrackStructType = FRecordedTransformTrack::StaticStruct();
RecordedTrackStructType->SerializeTaggedProperties(AfterAr, (uint8*)&RecordedData, RecordedTrackStructType, nullptr);
const int32 ArchiveBeforeSize = static_cast<int32>(BeforeAr.GetNum());
const int32 ArchiveAfterSize = static_cast<int32>(AfterAr.GetNum());