FDerivedDataCacheUsageStats

Copyright Epic Games, Inc. All Rights Reserved.

Windows
MacOS
Linux

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: <override cacheddataprobablyexists>=""> { auto Timer = UsageStats.TimeExists(); ... } <override getcacheddata>=""> { auto Timer = UsageStats.TimeGet(); ... <if it's a cache hit> Timer.AddHit(DataSize); Misses are automatically tracked } <override putcacheddata>=""> { auto Timer = UsageStats.TimePut(); ... <if the="" data="" will="" really="" be="" put>=""> Timer.AddHit(DataSize); Misses are automatically tracked } <override gatherusagestats>=""> { 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, *GraphPath), UsageStats); } }

Variables

Name Description

Public variable

FCookStats::Cal...

 

ExistsStats

Public variable

FCookStats::Cal...

 

GetStats

Expose these publicly for low level access. These should really never be accessed directly except when finished accumulating them.

Public variable

FCookStats::Cal...

 

PrefetchStats

Public variable

FCookStats::Cal...

 

PutStats

Functions

Name Description

Public function

void

 

Combine

(
    const FDerivedDataCacheUsageStats&...
)

Public function Const

void

 

LogStats

(
    FCookStatsManager::AddStatFuncRef A...,
    const FString& StatName,
    const FString& NodeName
)

Public function

FCookStats::...

 

TimeGet()

Call this at the top of the GetCachedData override.

Public function

FCookStats::...

 

TimePrefetch()

Call this at the top of the PutCachedData override.

Public function

FCookStats::...

 

TimeProbablyExists()

Call this at the top of the CachedDataProbablyExists override.

Public function

FCookStats::...

 

TimePut()

Call this at the top of the PutCachedData override.