Application Profiling for Tango

If a Tango application runs low on system resources, the Tango core functionalities may become less accurate or stop working entirely. This makes application profiling and optimization very important. In this section, we'll give you some tips on keeping your application running smoothly.

System load

There are two main types of system load issues - CPU usage and temperature.

CPU usage

Tango requires a certain amount of system resources to run, which means your application cannot use 100% of the CPU. If the system load is too high, Tango cannot process the sensor readings fast enough which will cause the system to drift or lose tracking.

The amount of CPU used by Tango depends on which functions you are using. Using area learning and/or depth perception requires more processing than motion tracking alone.

Temperature

As your application continues to run, the device begins to heat up. As the CPU heats up it slows down to avoid damage due to overheating. Specifically, when the CPU reaches 85C, it lowers the clockrate to produce less heat. If the slower speed is not enough for Tango plus your application's processing needs, performance will get worse.

Applications that are doing a constant amount of work will eventually hit a steady state where the device stops heating up. Under very heavy load, the development kit lowers its CPU speed to around 1.4 GHz, from the maximum 2.3 GHz.

You can use the Tango Debug Overlay to monitor the CPU. "Temp1" shows the CPU temperature while "CPU Freq" shows the current CPU speed. As your run your application, watch the temperature and frequency to see what the steady state for your application is. Debug Overlay writes these values to logcat if you want to monitor them automatically.

High temperatures and CPU downclocking are normal. They only cause trouble if the steady state CPU frequency is too low to support your application with Tango running. If this happens, you need to optimize your application to reduce the amount of constant work your application is doing.

If you prefer to use your own monitoring tools, make sure the temperature you track is /sys/class/thermal/thermal_zone1/temp, and not thermal_zone0 which is the default for most applications.

Profiling

If you need to reduce the system load of your application, profiling it can help identify where work is being done. There are many tools for profiling applications. The Android SDK includes ddms, including traceview for method profiling and systrace for process profiling.

We've found traceview's method profiling to be very useful for finding code to optimize.

Code optimization

Always follow best practices for the development language and environment you're using. For Tango specifically, the support libraries efficiently implement common functions. See our documentation on C Java and Unity for more information.

Send feedback about...