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
struct FDerivedDataUsageStats
Remarks
Stats for a resource class that uses the DDC to load the resource. This supports timing a call for synchronous work and asynchronous waits.
SyncWork timing should be any code that is explicitly synchronous, be it a DDC fetch or building the DDC resource. For SyncWork, a "hit" means we fetched from the DDC, and a "miss" means we had to build the resource. Either way, the bytes processed should be set appropriately via calls to AddHitOrMiss().
AsyncWait timing should be any code that is waiting on any explicitly asynchronous work to complete. This should only time the wait portion. A "hit" or "miss" should be interpreted the same way as in SyncWork. The Cycles counter should be measuring WAIT time, NOT the time the async task took to complete.
Many systems build assets in a very different spot in the code than they are retrieved. When that happens TrackCyclesOnly() should be called on the timer, and the Miss should be timed where the resource is actually built so the size can cycles used to build the resource can be tracked properly. In such cases, the time to TRY to get from the DDC will be timed along with the actual time to build the resource But there will only be a single CallCount recorded. This is desired so that every Miss() counted will properly equate to one resource built. Look for calls to TrackCyclesOnly() to see how this works in practice.
Async tasks can sometimes actually be executed synchronously if the code ends up waiting on the results before the task can even get started. Either way, this should be treated as "async" wait time. Be sure not to double count this time. Basically, do your counting at the level that decides whether to execute the work synchronously or not, so you can be sure to track the time properly as SyncWork or AsyncWait.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
FCookStats::CallStats | AsyncWaitStats | |
![]() |
FCookStats::CallStats | SyncWorkStats | Expose these publicly for low level access. These should really never be accessed directly except when finished accumulating them. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | LogStats
(
FCookStatsManager::AddStatFuncRef AddStat, |
|
![]() |
FCookStats::FScopedStatsCounter | Call this where the code is waiting on async work to build the resource | |
![]() |
FCookStats::FScopedStatsCounter | TimeSyncWork () |
Call this where the code is building the resource synchronously |