Navigation
Unreal Engine C++ API Reference > Runtime > Core > ProfilingDebugging
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/ProfilingDebugging/CookStats.h |
Include | #include "ProfilingDebugging/CookStats.h" |
Syntax
class FCookStatsManager
Remarks
Centralizes the system to gather stats from a cook that need to be collected at the core/engine level. Essentially, add a delegate to the CookStatsCallbacks member. When a cook a complete that is configured to use stats (ENABLE_COOK_STATS), it will broadcast this delegate, which, when called, gives you a TFunction to call to report each of your stats.
For simplicity, FAutoRegisterCallback is provided to auto-register your callback on startup. Usage is like:
static void ReportCookStats(AddStatFuncRef AddStat) { AddStat("MySubsystem.Event1", CreateKeyValueArray("Attr1", "Value1", "Attr2", "Value2" ... ); AddStat("MySubsystem.Event2", CreateKeyValueArray("Attr1", "Value1", "Attr2", "Value2" ... ); }
FAutoRegisterCallback GMySubsystemCookRegistration(&ReportCookStats);
When a cook is complete, your callback will be called, and the stats will be either logged, sent to an analytics provider, logged to an external file, etc. You don't care how they are added, you just call AddStat for each stat you want to add.
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
TArray< FCookStatsManager::StringKeyValue > | CreateKeyValueArray
(
ArgTypes&&... Args |
Helper to initialize an array of KeyValues on one line. |
![]() ![]() |
void | LogCookStats
(
AddStatFuncRef AddStat |
Called after the cook is finished to gather the stats. |
![]() ![]() |
TKeyValuePair< typename TDecay< KeyType >::Type, typename TDecay< ValueType >::Type > | MakePair
(
KeyType&& InKey, |
Helper to construct a TKeyValuePair. |
Classes
Type | Name | Description | |
---|---|---|---|
![]() |
FAutoRegisterCallback | Helper struct to auto-register your STATIC FUNCTION with CookStatsCallbacks | |
![]() |
TKeyValuePair | Copy of TKeyValuePair<> from Core, but with a default initializer for each member. |
Typedefs
Name | Description |
---|---|
AddStatFuncRef | When you register a callback for reporting your stats, you will be given a TFunctionRef to call to add stats. |
FGatherCookStatsDelegate | To register a callback for reporting stats, create an instance of this delegate type and add it to the delegate variable below. |
StringKeyValue | Every stat is essentially a name followed by an array of key/value "attributes" associated with the stat. |
Constants
Name | Description |
---|---|
CookStatsCallbacks | Use this to register a callback to gather cook stats for a translation unit. |