Package org.lwjgl.ovr

Class OVRPerfStats

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class OVRPerfStats
    extends Struct
    implements NativeResource
    This is a complete descriptor of the performance stats provided by the SDK.

    Member documentation

    • FrameStats[ovrMaxProvidedFrameStats] – an array of performance stats.

      The performance entries will be ordered in reverse chronological order such that the first entry will be the most recent one.

    • FrameStatsCount – will have a maximum value set by MaxProvidedFrameStats.

      If the application calls GetPerfStats at the native refresh rate of the HMD then FrameStatsCount will be 1. If the app's workload happens to force GetPerfStats to be called at a lower rate, then FrameStatsCount will be 2 or more.

      If the app does not want to miss any performance data for any frame, it needs to ensure that it is calling SubmitFrame and GetPerfStats at a rate that is at least: HMD_refresh_rate / ovrMaxProvidedFrameStats. On the Oculus Rift CV1 HMD, this will be equal to 18 times per second.

    • AnyFrameStatsDropped – If the app calls SubmitFrame at a rate less than 18 fps, then when calling GetPerfStats, expect AnyFrameStatsDropped to become True while FrameStatsCount is equal to MaxProvidedFrameStats.
    • AdaptiveGpuPerformanceScale – an edge-filtered value that a caller can use to adjust the graphics quality of the application to keep the GPU utilization in check. The value is calculated as: (desired_GPU_utilization / current_GPU_utilization)

      As such, when this value is 1.0, the GPU is doing the right amount of work for the app. Lower values mean the app needs to pull back on the GPU utilization. If the app is going to directly drive render-target resolution using this value, then be sure to take the square-root of the value before scaling the resolution with it. Changing render target resolutions however is one of the many things an app can do increase or decrease the amount of GPU utilization. Since AdaptiveGpuPerformanceScale is edge-filtered and does not change rapidly (i.e. reports non-1.0 values once every couple of seconds) the app can make the necessary adjustments and then keep watching the value to see if it has been satisfied.

    • AswIsAvailable – Will be true if Async Spacewarp (ASW) is available for this system which is dependent on several factors such as choice of GPU, OS and debug overrides.
    • VisibleProcessId – Contains the Process ID of the VR application the stats are being polled for. If an app continues to grab perf stats even when it is not visible, then expect this value to point to the other VR app that has grabbed focus (i.e. became visible).

    Layout

    
     struct ovrPerfStats {
         ovrPerfStatsPerCompositorFrame FrameStats[ovrMaxProvidedFrameStats];
         int FrameStatsCount;
         ovrBool AnyFrameStatsDropped;
         float AdaptiveGpuPerformanceScale;
         ovrBool AswIsAvailable;
         ovrProcessId VisibleProcessId;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • FRAMESTATS, FRAMESTATSCOUNT, ANYFRAMESTATSDROPPED, ADAPTIVEGPUPERFORMANCESCALE, ASWISAVAILABLE, VISIBLEPROCESSID

        The struct member offsets.
    • Constructor Detail

      • OVRPerfStats

        public OVRPerfStats​(java.nio.ByteBuffer container)
        Creates a OVRPerfStats instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • FrameStatsCount

        public int FrameStatsCount()
        Returns the value of the FrameStatsCount field.
      • AnyFrameStatsDropped

        public boolean AnyFrameStatsDropped()
        Returns the value of the AnyFrameStatsDropped field.
      • AdaptiveGpuPerformanceScale

        public float AdaptiveGpuPerformanceScale()
        Returns the value of the AdaptiveGpuPerformanceScale field.
      • AswIsAvailable

        public boolean AswIsAvailable()
        Returns the value of the AswIsAvailable field.
      • VisibleProcessId

        public int VisibleProcessId()
        Returns the value of the VisibleProcessId field.
      • malloc

        public static OVRPerfStats malloc()
        Returns a new OVRPerfStats instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static OVRPerfStats calloc()
        Returns a new OVRPerfStats instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static OVRPerfStats create​(long address)
        Returns a new OVRPerfStats instance for the specified memory address.
      • createSafe

        @Nullable
        public static OVRPerfStats createSafe​(long address)
        Like create, but returns null if address is NULL.
      • create

        public static OVRPerfStats.Buffer create​(long address,
                                                 int capacity)
        Create a OVRPerfStats.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        @Nullable
        public static OVRPerfStats.Buffer createSafe​(long address,
                                                     int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static OVRPerfStats mallocStack()
        Returns a new OVRPerfStats instance allocated on the thread-local MemoryStack.
      • callocStack

        public static OVRPerfStats callocStack()
        Returns a new OVRPerfStats instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static OVRPerfStats mallocStack​(MemoryStack stack)
        Returns a new OVRPerfStats instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static OVRPerfStats callocStack​(MemoryStack stack)
        Returns a new OVRPerfStats instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static OVRPerfStats.Buffer callocStack​(int capacity)
        Returns a new OVRPerfStats.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static OVRPerfStats.Buffer callocStack​(int capacity,
                                                      MemoryStack stack)
        Returns a new OVRPerfStats.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • nFrameStatsCount

        public static int nFrameStatsCount​(long struct)
        Unsafe version of FrameStatsCount().
      • nAnyFrameStatsDropped

        public static boolean nAnyFrameStatsDropped​(long struct)
        Unsafe version of AnyFrameStatsDropped().
      • nAdaptiveGpuPerformanceScale

        public static float nAdaptiveGpuPerformanceScale​(long struct)
      • nAswIsAvailable

        public static boolean nAswIsAvailable​(long struct)
        Unsafe version of AswIsAvailable().
      • nVisibleProcessId

        public static int nVisibleProcessId​(long struct)
        Unsafe version of VisibleProcessId().