If you want to profile your application to find performance bottlenecks you can use the
traceview tool. This gives you a graphical view of performance traces of your application.
To create a trace add the following to your code where you want to start tracing:
and then put the following when you want to stop tracing:
This will create a trace file call
myapp.trace in the root directory of the SD Card. As it is written to the SD Card:
Once the file has been created you'll need to copy it to your PC. You can do this using the
adb pull /sdcard/myapp.trace c:/my/dir/myapp.trace
traceview giving it the full path to the trace file:
I did have some problems with
traceview failing with
OutOfMemory exceptions. I fixed this on Windows by changing the last line of
call java -Djava.ext.dirs=%javaextdirs% -Dcom.android.traceview.toolsdir= -jar %jarpath% %*
call java -Xmx1g -Djava.ext.dirs=%javaextdirs% -Dcom.android.traceview.toolsdir= -jar %jarpath% %*
-Xmx1g option allows
traceview to use more memory.