docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Performance metrics

    The Android XR runtime defines different metrics that you can use to assess the performance of your application.

    Android XR metrics

    The following table describes the performance metrics paths that may be available on Android XR devices:

    Metric path Description
    /perfmetrics_android/app/cpu_frametime (milliseconds, float) Wallclock time client spent to process a frame.
    /perfmetrics_android/app/gpu_frametime (milliseconds, float) Wallclock time client spent waiting for GPU work to complete per frame. Notes: A high wait time can mean that the GPU was busy with other tasks, not necessarily that this client is doing too much GPU work. The GPU wait time can be zero if rendering was already complete when checked by the compositor.
    /perfmetrics_android/app/cpu_utilization (percents, float) Total app CPU utilization rate averaged over time. Can be higher than 100% on multi-core processors.
    /perfmetrics_android/app/motion_to_photon_latency (milliseconds, float) Time spent from user-initiated motion event to corresponding physical image update on the display.
    /perfmetrics_android/compositor/cpu_frametime (milliseconds, float) Wallclock time compositor spent to process a frame.
    /perfmetrics_android/compositor/gpu_frametime (milliseconds, float) Wallclock time compositor spent waiting for GPU work to complete per frame.
    /perfmetrics_android/compositor/dropped_frame_count (integer) Total number of dropped frames from all apps.
    /perfmetrics_android/compositor/frames_per_second (float) Number of compositor frames drawn on device per second.
    /perfmetrics_android/device/cpu_utilization_average (percents, float) Device CPU utilization rate averaged across all cores and averaged over time.
    /perfmetrics_android/device/cpu_utilization_worst (percents, float) Device CPU utilization rate of worst performing core averaged over time.
    /perfmetrics_android/device/cpu0_utilization through /perfmetrics_android/device/cpuX_utilization (percents, float, X is the number of CPU cores minus one) Device CPU utilization rate per CPU core averaged over one time.
    /perfmetrics_android/device/cpu_frequency (MHz, float) Device CPU frequency averaged across all cores and averaged over time.
    /perfmetrics_android/device/gpu_utilization (percents, float) Device GPU utilization rate averaged over time.

    Query supported metrics

    You can use the supportedMetricPaths property to get a list of available metric paths at runtime. You can use these metric paths with XRStats.TryGetStat to get the metric values.

    Note

    If there are any issues initializing this feature, supportedMetricPaths will be null and no metrics will be available.

    Example code

    The following code example demonstrates how to query for all supported metrics on the Android XR device:

    void Start()
    {
        IntegratedSubsystem m_Display = GetFirstDisplaySubsystem();
        AndroidXRPerformanceMetrics androidXRPerformanceMetrics = OpenXRSettings.Instance.GetFeature<AndroidXRPerformanceMetrics>();
    
        if (m_Display != null && androidXRPerformanceMetrics != null && androidXRPerformanceMetrics.supportedMetricPaths != null)
        {
            foreach (var metric in androidXRPerformanceMetrics.supportedMetricPaths)
            {
                Provider.XRStats.TryGetStat(m_Display, metric, out float stat);
    
                // process stat value
            }
        }
    }
    
    static IntegratedSubsystem GetFirstDisplaySubsystem()
    {
        List<XRDisplaySubsystem> displays = new List<XRDisplaySubsystem>();
        SubsystemManager.GetSubsystems(displays);
        if (displays.Count == 0)
        {
            Debug.Log("No display subsystem found.");
            return null;
        }
        return displays[0];
    }
    

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Android XR metrics
    • Query supported metrics
      • Example code
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)