Snapdragon Profiler: Find Bottlenecks and Optimize Your Code Faster

Tuesday 7/28/15 10:59am
Posted By Rick Schwartz
  • Up0
  • Down0

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

You can spend hours or even days trying to hunt down performance bottlenecks in your code. You can look for them in your app code that runs on the CPU, GPU, network and in memory by stepping through the code to enable/disable certain parts of the code, recompile and run the different configurations of the app on the device to understand the overhead of certain parts of the code. You will waste hours or days doing that and still you may be no closer to finding and optimizing the code that’s hogging resources.

Or you can run Snapdragon™ Profiler.

All in one
It’s not hard to find profiling and debugging tools for Android apps, but it is hard to find one that shows you power consumption, thermal profile, network usage, and performance on CPU, GPU and memory in a single UI. And to make it even better, it also supports profiling of Android Trace data.

Plug & play
We’ve just released Snapdragon Profiler for use on commercial devices. Try it out on that Nexus in your pocket to see everything you want to know – and more – about your app’s resource consumption so you can optimize your code more efficiently. And to do this analysis, you don’t need to make a single line of change in your commercial app code.

Everyone welcome
Snapdragon Profiler is for any kind of Android development; it’s not restricted to graphics and gaming. We’ve designed it for the needs of all developers: from low-level system developers customizing system features or developing native and embedded applications, to high-level app developers using Java. Snapdragon Profiler runs on most Android devices, and we recommend it especially for commercial (especially Nexus 5 and Nexus 6) and development devices (DragonBoard) powered by Snapdragon for the best development experience.

Say you’re creating UI for a social app, but you can see that it’s running slowly. You connect your device to your workstation via USB or Wi-Fi and run Snapdragon Profiler. You think your app should realistically be running at 60 frames per second, but the FPS metric shows it’s running at 20fps. You then use Snapdragon Profiler to experiment in real time with overrides that enable/disable functions like texture size, shaders and back-face culling. Maybe you remove the GPU call altogether.

If you still see no improvement, that’s a strong hint that you have a CPU bottleneck, so you focus on CPU Core Frequency and CPU Core Utilization for points where they spike, as in Figure 1.

Multiple interaction modes
The Snapdragon Profiler client software on your desktop machine lets you profile your applications running on the device in three different modes:

  • Real-time: While your app is running on the device, you start profiling. On the desktop you see metrics graphed as soon as the device sends them, as shown in Figure 1. This mode is useful to get a glance of events and their effects as they happen in “real-time”.

    Figure 1: Real-time mode

  • Trace view: You can select different Android Trace events, then start capture, stop capture and analyze the events afterwards, as shown in Figure 2. This mode is useful when you know are trying to understand the system usage data for your application over time and want to viualize the data in detail as an offline analysis.

    Figure 2: Trace view mode

  • Snapshot: When you’re getting poor graphics performance in a particular frame or scene, use snapshot mode. This mode lets you visualize all the resources like textures, shaders, draw calls, OpenGL ES states for that particular frame. You can edit the shaders, look at the mip levels for the textures and examine workload of different draw calls and states. Apart from all the great features, one of the powerful features of Snapshot mode is that it lets you examine the pixel history (see Figure 3).

    Figure 3: Snapshot mode

Something new
Everybody enjoys a hot game, but nobody wants to play it on a hot (literally) device that drains battery fast. As a developer you should not just care about measuring performance, but you should also measure and optimize power and thermal aspects of your application on the target commercial device to ensure the best user experience. Snapdragon Profiler allows you to visualize, correlate, experiment various parts of the system to help you understand how you can optimize for power and thermal aspects.

To avoid conflicts in collecting power and temperature data through USB while the device is charging, we’ve enabled ADB interface over Wi-Fi for the most accurate power and thermal metrics possible.

Next steps
Snapdragon Profiler combines several of our previous tools like Adreno™ GPU Profiler and Trepn™ Power Profiler and exposes in a single UI lots of information you couldn’t see before. Download Snapdragon Profiler now and begin profiling and optimizing your app right away.