The
Application Performance improvement process is one of the real challenges in
the mobile application development. Android provides various tools to analyze
the performance of the application, like-DDMS, Traceview, Allocation Tracker. The memory
analysis can be done through Eclipse Memory Analysis Tool which a very powerful
tool. It provides various analysis, like-Histogram, Dominator Tree, Leak
Suspects along with chart analysis.
Traceview
This post covers the time analysis of
an application, i.e. Stock Watch Application (which is one of my in-house
developments) for an example, by using Traceview tool and the improvements observed
in the application performance on post-optimization.
Traceview
Traceview is a graphical viewer for
execution logs that you creates by using the Debug class to log tracing information in your code. Traceview
can help you debug your application and profile its performance. It displays
the log files data in two panels:
- A timeline panel -- describes when
each thread and method started and stopped
- A profile panel -- provides a summary of what happened inside a method
Traceview
helps us to find out the time spent in each method so that we could track the
performance of each method we have written in the application.
1.
Start
with Traceview profiling: Open Eclipse->DDMS->Devices(Tab), select the process of your
application in the all the processes running on emulator/device. Now press ‘Start Method Profiling’ button as shown
in below image.
2.
Application
Navigation: Navigate to the application parts for which you
want to create the profiling
3.
Stop
Profiling: From the Devices
Tab, select ‘Stop Method Profiling’ button as shown in below image. A profiling
report will get generate automatically where you can start analysis.
As shown
in the below image of Traceview report, the navigation time of these two
activities is 51000 milliseconds*. The control
was in the main Asynchronous thread for a large amount of time.
*since it is tested at android emulator; on
device we might found the time difference.
After optimizing
the code, the navigation time has been reduced
from 51000 milliseconds to 42000 milliseconds.
Performance
Improvements
Improving application performance in terms of time
and memory is one of the real challenges in mobile development. The android
native tools like-DDMS/Traceview plays a significant role in improving the
performance. Also these performance tests can be executed during the
development life cycle.
Following are the performance improvements by using
both the tools:
v Using Traceview:
·
Navigation time reduced by 18%
·
Time spent by program control
in Asyn Thread is lessened.
Hope now
you can take advantage of Traceview tool to improve the performance of your
application.
Note: The later parts of this post will
cover the other tools analysis to improve android app performance. Keep an
eye!! J