Using DDMS to test the performance of your Android app (Android)

Source: Internet
Author: User

Installation/configuration:

Another tool can also test the performance of the mobile client app, which is the Ddms tool in the Android Development Kit (Dalvik Debug Monitor Service), first of all the installation of the Android SDK:

1, first install jdk,1.5 above version

2, after the installation of the JDK, you need to download and install the Android SDK, namely: android-sdk-windows, compressed packet about about 551M

3, decompression android-sdk-windows, placed in the root directory of the C drive, configure the system variable Path value is: C: \android-sdk-windows\tools

Start:

1, can enter the DDMS in the operation

2, can also be launched in the C: \android-sdk-windows\tools directory Ddms.bat

Connection:

1. Use the data cable to connect the Android phone to confirm that the phone is in "USB Debug" mode

1) Press the "menu" button on the phone and select "Setting" in the popup menu.
2) Select "Application";
3) Tick "unknown source" in this interface and select "Develop";
4) Tick "USB Debug", "Keep Awake";

2, in the left Ddms box will show the mobile phone has opened the app (app) process, if not displayed, you can connect a few times, or change a phone to try

Operation:

The premise is to open the Mobile client app that we want to analyze (Web-based APK program)

1. Click to select the process you want to monitor, such as the system_process process;
2. Click to select the "Update Heap" icon in the top row of icons in the Devices view interface;
3. Click the "Cause GC" button in the heap view;
4. In the heap view, you will see the details of the memory usage of the currently selected process.

Analysis:

How do we know if our program has the possibility of a memory leak? Here's a value to note: In the middle of the heap view, there is a type called data object, which is an object of the class type that exists in our program. In the data object row, there is a column "total size", whose value is the amount of memory for all Java data Objects in the current process, in general, the size of this value determines whether there is a memory leak. It can be judged as follows:

A) continuously operate the current application, while observing the total size value of the data object;

b) The total Size value will be stable in a limited range under normal circumstances , that is, because the code in the program is good, there is no object is not garbage collection, so that although our continuous operation will continue to generate many objects, And in the process of the virtual machine continuous GC , these objects are recycled , memory consumption will fall to a stable level;

c) Conversely, if there is a case in the code that does not release the object reference, the total size value of the data object does not come down significantly after each GC, and as the number of operations is increased, the value of total size becomes larger until an upper limit is reached, causing the process to be killed.

D) The system_process process is here, for example, the total size of the data object that system_process the memory occupied by the process in my test environment will normally stabilize between 2.2~2.8, And when the value exceeds 3.55, the process is killed.

Reference Document: Http://www.cnblogs.com/zhuque/archive/2013/04/02/2995802.html

Using DDMS to test the performance of your Android app (Android)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.