Android game development part 1 (Testing performance)

Game development for Android is not a simple thing as you can imagine from the first view. First of all we should talk about Testing performance with eclipse.
Let’s see what we need to test performance:
  1. eclipse
  2. android SDK
  3. android plugin for eclipse
We have to have an android emulator with SD card for testing. SD card should be at least 64mb because android writes performance data directly to the SD card. Writing to SD card meant that we have to give android.permission.WRITE_EXTERNAL_STORAGE right to tested application.
And when we have all this stuff installed, we can start testing. Run your program in debug mode, switch perspective to DDMS. And here you can find all performance testing tools like “Memory allocation tracker“, “Method tracing“, and “Dump HPROF“.
Memory allocation tracker give us possibility to check in runtime where and how much memory we allocate in our program. This is an important part of performance improvement because memory allocation is very expensive operation in android.To run this tool you have to switch to the Allocation Tracker tab and press Start tracking button. From this moment Allocation tracker collects all memory allocations called from your program. To see this allocations we have to press Get allocations button.

Method tracing is my favorite tool. This tool give you a comprehensive chart with all method calls and it’s execution time, but it has 3 types of times: Inclusive, Exclusive and Time/call. Inclusive time means time this method was run by another. Exclusive time means time this method spent for it’s own calculation(not calling another methods). And the most important value Time/call. This time means average calling time. The bad news is that this tool allows trace only limited count of calls.
Dump HPROF is the last tool for performance testing. This tool gets and Heap Profile file from android emulator, which you can open using Memory Analyzer Tool.