Writing a Performance Heartbeat Analytics

Hi, I’m writing a performance heart beat for our game analytics and have come across some quirks.

The ideal metric is just to call GEngine->GetAverageUnitTimes(TArray&) (UEngine::GetAverageUnitTimes | Unreal Engine Documentation)

Once every heartbeat (1 second or so) The trouble is this returns 0s unless the DrawStat function is running (from the commandline “Stat FPS”). This function fills in SET_FLOAT_STAT(STAT_UnitRender, RenderThreadTime) for the current frame as well as GEngine->SetAverageUnitTimes.

To get around this I can get GRenderThreadTime from Render core and copy and paste all the work done in DrawStat, but I feel like I should be able to leverage the engine more.

Is there a better way to get the unit stats on a performance heartbeat?


Were you able to solve this? I’m curious since I was thinking about implementing something like this.