The Android SDK tool Systrace can be modified to provide low-level GPU pipeline data for apps running on Oculus Quest. This data includes information on the render stages of the pipeline and timing data for each stage. Once GPU Systrace functionality has been enabled, it can be performed from the command line or Android Device Monitor.
GPU Systrace supports render stage GPU tracing on a tile-per-tile level. Unlike direct-mode GPUs, which execute draw calls sequentially, tile-based renderers batch draw calls for an entire surface, then that surface is split into tiles that are computed sequentially, where each tile executes all the draw calls that touched that tile. GPU Systrace can tell you how much time was spent in each rendering stage for each surface rendered during a trace’s duration.
GPU Systrace uses the installation of Systrace that comes with the Android SDK in the <ANDROID_SDK_DIR>/platform-tools/systrace/catapult/systrace/systrace
folder. To use GPU Systrace, download systrace_trace_viewer.html
from our Downloads page and place it in the <ANDROID_SDK_DIR>/platform-tools/systrace/catapult/systrace/systrace
folder, replacing the file if it already exists.
Before use, GPU Systrace requires an additional step to enable detailed profiling mode on the Oculus Quest. Establish an ADB connection with the Oculus Quest and run the following command from a command prompt to prepare for GPU profiling:
adb shell ovrgpuprofiler -e
Detailed profiling mode must be enabled before the app to be traced is launched.
Apps being used with GPU Systrace must have the <uses-permission android:name="android.permission.INTERNET" />
permission in its manifest.
After detailed profiling mode has been enabled, render stage tracing can be performed from the command line or Android Device Monitor.
Follow these steps to take a render stage trace from the command line:
<ANDROID_SDK_DIR>/platform-tools/systrace
.adb shell pm list packages
python2 systrace.py --app="<app name>" app renderstage
The new renderstage
category initiates the GPU trace.
The output file containing the trace will be located at <ANDROID_SDK_DIR>/platform-tools/systrace/trace.html
.
Follow these steps to take a render stage trace with Android Device Monitor:
<ANDROID_SDK_DIR>/tools/monitor.bat
.The output file containing the trace will be located at the location selected in the dialog.
Open the output file in Google Chrome and you will see something similar to the following image:
The red square indicates the location of the zoom toggle. With the zoom toggle enabled, you can zoom in by holding down the left mouse button and dragging the mouse.
The red square indicates the location of the pan toggle. With the pan toggle enabled, you can move the view around by holding down the left mouse button.
Look at the GPU Timeline. Pan to find a surface and zoom in until you can see the render stages for the surface beneath it. You can click on the surfaces and their render stages to view more detailed information at the bottom of the screen. The Flow events, Processes, and Options buttons at the top of the trace provide different ways to filter and highlight flows and data.
When looking at the trace, the colors indicate the render stage:
The following render stages are less common: