How can I debug / profile World Tick Time?

I am having an issue while trying to develop a VR game in Unreal Engine 5.2.

Even using the starter sample project or an empty world, the World Tick Time seems to be bottlenecked even when nothing has been added or changed in the level yet. It ends up making the cpu frame time go over 11.1ms so it’s not hitting my target 90hz.

I tried to profile it, but I seem to get stuck at World Tick Time > Self (see image).

Was wondering what my next steps should be to try and figure out what is causing the game thread to take so long even on empty projects in VR.

Headset I am using is the HP Reverb G2.

1 Like

The game thread might be waiting on the render thread. I’d suggest profiling with Unreal Insights instead to see what the threads are doing relative to each other, and with the frame time profiling tools in the VR runtime to see if its the application or something else that is the bottleneck.

Hello, just wanted to update on my progress.

The problem with World Tick Time I found is that the frame time gets unsynched when Garbage Collection runs.

Afterward, every xrWaitFrame waits an unnecessary amount of time, of which it can increase further on more garbage collections or other thread stalls.

I found that if I measure the time xrWaitFrame takes and it is over a threshold (I set mine to 1ms), and I make it immediately return on the next pass, it fixes the issue. Though obviously not fully ideal since every time GC is run you will get a 1 frame skip. If you have GC running once per minute, you’ll notice the skip every minute. I combined this with extending the “Time Between Purging Pending Kill Objects” setting to 10 minutes and now don’t really have any issues. Just that once every 10 minutes you may or may not notice a frame skip. Would be better if instead of skipping it was able to sync the timings up another way, but still need to figure that out. Runs great now though…

I made my changes in the FOpenXRHMD::OnBeginSimulation_GameThread() function in OpenXRHMD.cpp.

1 Like

Sounds like the VR runtime could be throttling the frame rate in order to run motion reprojection. It’s supposed to drop back to the full frame rate after a while though, and having it start throttling after one missing frame seems weird. I’m not familiar with how the WMR runtime handles it though.

This is with motion reprojection disabled. When enabled, the effect is way more pronounced since it seems to have a multiplicative effect on the game thread frame time.

The runtime might still be trying to throttle the frame rate for some reason. It’s the runtime that’s supposed to be controlling frame timing, so guessing something is up with it, rather than the application. The reprojection systems are supposed to work really well for small single frame hiccups.

Ya, it may likely be related to the MixedRealityRuntime. Though even if it may not be an issue with Unreal Engine, I would still like to have it handle the situation gracefully. The current changes I added, though not very pretty, work almost perfectly except for the single frame skip on GC. Not really noticeable if I reduce the run frequency of GC. Still looking for a way to sync up the frame times without the skip though…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.