FDerivedDataCacheUsageStats

Copyright Epic Games, Inc. All Rights Reserved.

Unreal Engine C++ API Reference > Developer > DerivedDataCache

References

   
Module DerivedDataCache
Header /Engine/Source/Developer/DerivedDataCache/Public/DerivedDataCacheUsageStats.h
Include #include "DerivedDataCacheUsageStats.h"

Syntax

class FDerivedDataCacheUsageStats  

Remarks

Usage stats for the derived data cache nodes. At the end of the app or commandlet, the DDC can be asked to gather usage stats for each of the nodes in the DDC graph, which are accumulated into a TMap of Name->Stats. The Stats portion is this class.

The class exposes various high-level routines to time important aspects of the DDC, mostly focusing on performance of GetCachedData, PutCachedData, and CachedDataProbablyExists. This class will track time taken, calls made, hits, misses, bytes processed, and do it for two buckets: 1) the main thread and 2) all other threads. The reason is because any time spent in the DDC on the main thread is considered meaningful, as DDC access is generally expected to be async from helper threads.

The class goes through a bit of trouble to use thread-safe access calls for task-thread usage, and simple, fast accumulators for game-thread usage, since it's guaranteed to not be written to concurrently. The class also limits itself to checking the thread once at construction.

Usage would be something like this in a concrete FDerivedDataBackendInterface implementation: class MyBackend : public FDerivedDataBackendInterface { FDerivedDataCacheUsageStats UsageStats; public: =""> { auto Timer = UsageStats.TimeExists(); ... } =""> { auto Timer = UsageStats.TimeGet(); ... Timer.AddHit(DataSize); // Misses are automatically tracked } =""> { auto Timer = UsageStats.TimePut(); ... =""> Timer.AddHit(DataSize); // Misses are automatically tracked } =""> { // Add this node's UsageStats to the usage map. Your Key name should be UNIQUE to the entire graph (so use the file name, or pointer to this if you have to). UsageStatsMap.Add(FString::Printf(TEXT("%s: "), *GraphPath), UsageStats); } }

Variables

Type Name Description
FCookStats::Cal... ExistsStats  
FCookStats::Cal... GetStats Expose these publicly for low level access. These should really never be accessed directly except when finished accumulating them.
FCookStats::Cal... PrefetchStats  
FCookStats::Cal... PutStats  

Functions

Type Name Description
void Combine ( const FDerivedDataCacheUsageStats&... )  
void LogStats ( FCookStatsManager::AddStatFuncRef A..., const FString& StatName, const FString& NodeName )  
FCookStats::... TimeGet () Call this at the top of the GetCachedData override.
FCookStats::... TimePrefetch () Call this at the top of the PutCachedData override.
FCookStats::... TimeProbablyExists () Call this at the top of the CachedDataProbablyExists override.
FCookStats::... TimePut () Call this at the top of the PutCachedData override.

Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library