How can I test an application for performance in Android? What is the support provided in Android and how do I use it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to profile your application to find performance bottlenecks you can use the
traceviewtool. 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.tracein the root directory of the SD Card. As it is written to the SD Card:You’ll need to give you app permission to write the SD card by adding the following to your Manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />Once the file has been created you’ll need to copy it to your PC. You can do this using the
adbcommand:Finally, start
traceviewgiving it the full path to the trace file:I did have some problems with
traceviewfailing withOutOfMemoryexceptions. I fixed this on Windows by changing the last line oftraceview.batfrom:to:
Adding the
-Xmx1goption allowstraceviewto use more memory.