FrameCacheLenght
FrameCacheLenght
#Overview
name: FrameCacheLenght
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FrameCacheLenght is to control the duration of the frame cache in the Visual Logger system of Unreal Engine 5. It is used to determine how long visual logging data should be stored in memory before being written to a file.
This setting variable is primarily used by the Visual Logger subsystem, specifically within the FVisualLoggerBinaryFileDevice class, which is part of the Engine module. This class is responsible for writing visual logging data to binary files.
The value of FrameCacheLenght is set in the constructor of FVisualLoggerBinaryFileDevice. It reads the default value from the engine configuration file (GEngineIni) using the GConfig system. The configuration key is “FrameCacheLenght” under the “VisualLogger” section.
FrameCacheLenght interacts with other variables in the FVisualLoggerBinaryFileDevice class, such as LastLogTimeStamp and the FrameCache array. It is used in conjunction with these variables to determine when to flush the cached log entries to the file.
Developers should be aware that:
- This variable affects the memory usage and file I/O frequency of the Visual Logger system.
- A longer FrameCacheLenght will keep more data in memory before writing to disk, which can be beneficial for performance but may increase memory usage.
- A shorter FrameCacheLenght will write data to disk more frequently, potentially impacting runtime performance but reducing memory usage.
Best practices when using this variable include:
- Carefully consider the trade-off between memory usage and file I/O frequency when setting this value.
- Monitor the performance impact of different FrameCacheLenght values in your specific use case.
- Ensure that the value is appropriate for the expected frequency of visual logging events in your application.
- Consider exposing this setting as a configurable option for end-users or developers to fine-tune based on their specific needs or hardware capabilities.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3240, section: [VisualLogger]
- INI Section:
VisualLogger
- Raw value:
1.0f ;in seconds, to batch log data between file serializations
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/VisualLogger/VisualLoggerBinaryFileDevice.h:30
Scope (from outer to inner):
file
class class FVisualLoggerBinaryFileDevice : public FVisualLogDevice
Source code excerpt:
protected:
int32 bUseCompression : 1;
float FrameCacheLenght;
double StartRecordingTime;
double LastLogTimeStamp;
FArchive* FileArchive;
FString TempFileName;
FString FileName;
TArray<FVisualLogEntryItem> FrameCache;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VisualLogger/VisualLoggerBinaryFileDevice.cpp:12
Scope (from outer to inner):
file
function FVisualLoggerBinaryFileDevice::FVisualLoggerBinaryFileDevice
Source code excerpt:
bool DefaultFrameCacheLenght = 0;
GConfig->GetBool(TEXT("VisualLogger"), TEXT("FrameCacheLenght"), DefaultFrameCacheLenght, GEngineIni);
FrameCacheLenght = DefaultFrameCacheLenght;
bool UseCompression = false;
GConfig->GetBool(TEXT("VisualLogger"), TEXT("UseCompression"), UseCompression, GEngineIni);
bUseCompression = UseCompression;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VisualLogger/VisualLoggerBinaryFileDevice.cpp:101
Scope (from outer to inner):
file
function void FVisualLoggerBinaryFileDevice::Serialize
Source code excerpt:
{
const int32 NumEntries = FrameCache.Num();
if (NumEntries> 0 && LastLogTimeStamp + FrameCacheLenght <= LogEntry.TimeStamp && FileArchive)
{
FVisualLoggerHelpers::Serialize(*FileArchive, FrameCache);
FrameCache.Reset();
LastLogTimeStamp = LogEntry.TimeStamp;
}