Module |
|
Header |
/Engine/Source/Runtime/Core/Public/ProfilingDebugging/CookStats.h |
Include |
#include "ProfilingDebugging/CookStats.h" |
class FCookStatsManager
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.
Name | Description | ||
---|---|---|---|
|
CreateKeyValueArray ( |
Helper to initialize an array of KeyValues on one line. |
|
|
LogCookStats ( |
Called after the cook is finished to gather the stats. |
|
|
TKeyValuePai... |
MakePair ( |
Helper to construct a TKeyValuePair. |
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. |
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. |
Name |
Description |
---|---|
CookStatsCallbacks |
Use this to register a callback to gather cook stats for a translation unit. |