Skip to main content
New Participant
May 11, 2022

Get GPU frametime on Quest

I'm trying to implement Unity's Dynamic Resolution as a quick fix for the remaining GPU-bound scenarios in our game, but I'm running into the issue that I can't seem to get the last GPU frametime no matter what API I use. Neither FrameTimingManager.GetLatestTimings, XRStats.TryGetGPUTimeLastFrame, nor XRDisplaySubsystem.TryGetAppGPUTimeLastFrame seem to work on my Quest 2 (but do in-editor via Link). What is the preferred method to get the GPU frametime on Quest?

 

To clarify, the game is using Vulkan and the VRAPI (not OpenXR).

    This topic has been closed for replies.

    2 replies

    New Participant
    October 17, 2022

    I'm having this exact issue. Did you ever find a solution? I've tried no less than 6 different API calls to try and get this information, yet they all fail or return 0.

    New Participant
    October 18, 2022

    I got it. 

    You need this in your Start/Awake function (or whenever you want to start tracking the GPU App time)

     

    void OnEnable()
    {
        Unity.XR.Oculus.Stats.PerfMetrics.EnablePerfMetrics(true);
    }
    
    void OnDisable()
    {
        Unity.XR.Oculus.Stats.PerfMetrics.EnablePerfMetrics(false);
    }

     

     

    Then, in your Update...

     

    float appGPUTime = Unity.XR.Oculus.Stats.PerfMetrics.AppGPUTime;

     

     

    That got it for me.

    Hope that helps!