Profiling VR Apps for Better Performance

Thursday 12/15/16 01:09pm
Posted By Rick Schwartz
  • Up0
  • Down0

Qualcomm products mentioned within this post are offered by
Qualcomm Technologies, Inc. and/or its subsidiaries.

High performance in virtual reality apps is important to users, but we developers need to be smart about how we deliver it.

Does it surprise you to learn that 96% of mobile users consider performance important? If it’s that important to users, then it should be that important to us. Even if performance isn’t our highest priority, as developers we have a responsibility to make sure we’re not running pesky background services and draining the battery needlessly. And as VR hardware becomes more accessible, our apps shouldn’t cause a headset to overheat.

Qualcomm® Snapdragon™ Profiler allows you to analyze CPU, GPU, DSP, memory, power, thermal and network data so you can find and fix the performance bottlenecks in your apps that waste power and generate heat. Along with tools in our Symphony™ SDK and Adreno™ SDK, Snapdragon Profiler is a step on the path to heterogeneous programming and a valuable tool in building VR applications. It shows you how your code affects different cores and resources on the Snapdragon processor.

In this post I’ll show you three ways you can use Snapdragon Profiler to examine what’s happening inside your app. In my next post I’ll describe three worst practices of VR programming and show you how to profile them.

When your app is too hot

First, here’s an example, brought to you by mobile devices that get uncomfortably warm.

We’ve all read and seen what happens when a phone runs too hot. Temperature matters, whether it accumulates in the battery, the memory or the computing cores. That’s why Snapdragon Profiler shows you how your app affects temperature in the test device and how temperature affects compute power.

The screenshot below comes from Snapdragon Profiler running on my desktop while connected via USB to a very CPU-intensive app running on my test device.

The operating temperature of the CPU cores could stay at 150°F/65°C for only so long before frequency collapse, when the system scheduler and power monitors told the cores to run at a lower clock frequency so the device could cool off. You can see that CPU 0/1/2/3 Frequency and GPU % Utilization fell off like a rock for about one minute, then gradually inched back up.

If that happened in your VR app, how do you think it would affect user experience? Performance too would fall off like a rock. Your app would struggle to render frames as before, but at a lower clock frequency and a lower frame rate. The hardware wouldn’t be able to keep up. Your users would one-star you to death.

Three modes for profiling Snapdragon

That’s the kind of information Snapdragon Profiler gives you about your app. It offers three different modes for exploring app performance.

  1. Real time – The screenshot above shows profiling in Snapdragon Profiler’s real-time mode, with my development machine connected to the test device via ADB over USB (or Wi-Fi). You can select running apps, services and widgets and see how they affect CPU, GPU, memory, network and thermal profile.
  2. Trace capture –  To display kernel and system performance over time, trace mode captures events at a high sample rate. In the screenshot below, Snapdragon Profiler shows DSP metrics and driver activity as surfaces are rendered in a VR app.

  1. Snapshot – Analyze textures at the frame and buffer level in snapshot mode. You can see how your scene is being constructed with OpenGL ES: draw calls, object attributes, shader code and pixel history. In the partial snapshot below I’ve indicated the draw calls for right eye and left eye in a VR app.

Snapdragon Profiler works with all devices powered by Snapdragon processors. That includes commercial and development boards such as the DragonBoard 410c. (Expect limited functionality on non-Snapdragon devices.) The more recent the device and version of Android, the more valuable the information you can get from Snapdragon Profiler.

Next steps

Snapdragon Profiler is available now, waiting for you to download and install.

  • Check system requirements. We’ve made them pretty undemanding so you can start profiling right away.
  • Our FAQ covers installation, capabilities and troubleshooting.
  • We’ve put together a 6-minute video about using the profiler, featuring yours truly.

In the world of VR apps, Snapdragon Profiler can help you make the most of the 16ms you have (well, really about 12-14ms) for rendering each frame for both eyes. I’ll cover that in my next post.

And if you plan to attend AnDevCon, stop by my session called Profiling VR Games and Applications for Optimum Performance. Bring plenty of questions.