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 to the Android phone, confirm that the phone is in "USB Debug" mode

1) Press "menu" button on the phone, select "Setting" in the pop-up menu,  
2) Select "Application";  
3) Check" unknown source "in this interface and select" Development ",  
4) Tick" USB Debug "," Stay 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 that you want to monitor, such as the system_process process;  
2. Click to select the icon in the top row of the Devices view screen. Update Heap icon;  
3. Click the "Cause GC" button in the heap view;  
4. In the heap view, you will see 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) continue to operate the current application, while observing the total size value of the data object;

B)   normal total Size value will stabilize within a limited range , That is, because the code in the program is good, there is no case that the object is not garbage collected, so we say although our continuous operation will generate many objects constantly, and in the virtual machine constantly GC , the objects are recycled , and the memory footprint falls 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://HI.BAIDU.COM/2012JASONHAO/ITEM/27FAFB0C014A5AC42F4C6B25

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.