Skip to content

Profiling tools for Meta Quest 2

moraaar edited this page Nov 1, 2022 · 9 revisions

This document contains a list of tools to do CPU and GPU profiling on the Quest 2. For each tool you'll find steps for how to install them and how to use them.

  • VrApi Stats: Great for getting generic CPU/GPU stats with just looking at the log.
  • OVR Metrics app: Great for seeing generic CPU/GPU stats of your choice in a HUD inside your app.
  • Oculus Developer Hub (ODH): Great for getting lots of CPU/GPU stats live while your app is running with a simple click of a button.
  • Perfetto: Great for capturing and analyzing CPU data in great depth, check where the CPU time is going, see threads running on specific cores and see your app's threads.

Steps to build and run OpenXR gems in O3DE for Quest 2 can be found here: Build and Run OpenXR in O3DE

NOTE

To capture more accurate profiling data, run your app on Quest 2 using a profile build and run with rhi-device-validation disabled (which it's disabled by default on profile).

VrApi Stats

Meta Quest apps always logs to logcat VrApi stats with basic performance statistics once per second.

Run "adb logcat -s VrApi" to filter the stats while a meta quest app is running. Example:

VrApi: FPS=72,Prd=46ms,Tear=0,Early=72,Stale=0,VSnc=1,Lat=1,Fov=0,CPU4/GPU=2/4,1651/670MHz,OC=FF,TA=0/E0/0,SP=N/F/N,Mem=1804MHz,Free=1642MB,PSM=0,PLS=0,Temp=31.0C/0.0C,TW=3.40ms,App=0.69ms,GD=0.97ms,CPU&GPU=3.86ms,LCnt=3,GPU%=0.37,CPU%=0.08(W0.10)

Details of what each stat mean can be found in the following link: VrApi Stats Definition Guide

OVR Metrics app

Tool that runs on Quest 2 to provide various performance metrics. Much of the information is similar to that provided by VrApi logcat logs. It can also report GPU stats (ovrgpuprofiler real-time metrics) if enabled.

Installation:

  • Easiest way to install OVR Metrics app into Quest 2 is using Oculus Developer Hub (ODH). Download and install ODH in your PC: Meta Quest Developer Hub for Windows 
  • Open ODH
  • Connect Quest 2 to PC
  • Inside ODH go to Device Manager tab, in the Device Actions area click on "Install" button beside OVR Metrics option.
  • To enable GPU stats, inside ODH, go to Device Manager tab, in the Device Actions area enable the "GPU Profiling Service" option.

OVR Metrics app has 2 modes: Performance HUD Mode (show stats on screen in real time) and Report Mode (records stats and later show it in OVR Metrics app).

How to use Performance HUD Mode (recommended):

  1. Open OVR Metrics app on Quest 2.
  2. Click on "Enable persistent overlay" option.
  3. Enable all the stats and graphs you want. Recommended to use the scale option to make stat text size bigger.
  4. Press X to minimize the app.
  5. Open your app. The overlay will keep updating the stats.
  6. Tip: you can use ODH to take a screenshot at any time.

NOTE: The button "Metrics HUD" in ODH can also be used to control the HUD, but I found it behaves erratically sometimes.

PICTURE HERE

How to use Report Mode:

  1. Open OVR Metrics app on Quest 2.
  2. Click on "Record all captured metrics to csv files" option.
  3. Enable all the stats and graphs you want.
  4. Press X to minimize the app.
  5. Open your app, it will start recording stats, close you app.
  6. Open OVR Metrics app.
  7. Click on the 3 dots button on the top right corner and select "View Recorded Sessions" option.
  8. Click on your app's session.
  9. It will show the stats recorded.

NOTE: The button "Metrics Recording" in ODH can also be used, but I didn't get it to record the stats when I tried it, it's more reliable to use the app directly.

PICTURE HERE

You can uninstall OVR Metrics app from your Quest 2 at any time either via ODH (under Device Manager tab > Apps section > click "..." in com.oculus.ovrmonitormetricsservice > uninstall)

Useful Links:

Oculus Developer Hub (ODH)

ODH is a tool running on PC which can communicate with the Quest 2 to do many development actions (install apps, launch/stop apps, profile apps, app logs, record videos, cast device, install tools, etc.)

Installation:

  • Download ODH installer from this link: Meta Quest Developer Hub for Windows
  • Run the installer
  • To enable GPU stats, inside ODH, go to Device Manager tab, in the Device Actions area enable the "GPU Profiling Service" option.

The Performance Analyzer tab bundles several tools such as OVR Metrics, Perfetto, and logs from Logcat to closely monitor and analyze the performance-specific metrics.

How to use Performance Analyzer:

  1. Open ODH
  2. Connect Quest 2 to PC
  3. Open your app
  4. In ODH, go to Performance Analyzer tab
  5. Click on the play button to start profiling live and gather stats.

Useful Links:

PICTURE HERE

Perfetto

Perfetto is the platform-wide tracing tool introduced in Android 10. It is a sophisticated open-source tracing project for Android, Linux, and Chrome. It offers a superset of data sources compared to Systrace and allows you to record arbitrarily long traces in a protocol buffer binary stream. You can open these traces in the Perfetto UI.

NOTE

O3DE does not have instrumentation for Perfetto yet.

In order for events from your app to show up in a Perfetto trace, your app must be annotated either with Perfetto TrackEvents or with ATrace.

Installation:

  • Easiest way to do Perfetto captures in Quest 2 is via Oculus Developer Hub (ODH). Download and install ODH in your PC: Meta Quest Developer Hub for Windows 
  • To enable GPU stats, inside ODH, go to Device Manager tab, in the Device Actions area enable the "GPU Profiling Service" option.

How to do trace analysis in Perfetto from ODH:

  1. Open ODH

  2. Connect Quest 2 to PC

  3. Open your app

  4. In ODH, go to either Device Manager or Performance Analyzertab.

  5. In the section "Trace Analysis by Perfetto" clicking on "..." > Perfetto settings, you can configure what's going to be captured when recording.

    a) O3DE doesn't emit Perfetto's ATrace or TrackEvents data yet. But when it does, then use "ATrace Apps" or "TrackEvent" fields to track O3DE with more detailed information.

  6. Click on the "Record" button. If Trace duration setting was fixed duration it will stopped automatically, otherwise press the stopped button when desired to stop recording.

  7. When it stops recording, if the "Auto open trace" was enabled, it will automatically open Chrome showing all the info captured. a) The following picture summarizes the stats found in Perfetto
    PICTURE HERE

  8. You can managed the recorded traces clicking on "..." > Recorded Traces button.

Useful Links: