Test Android app performance with apt

Source: Internet
Author: User
Tags root access

First, APT introduces:

Apt:android Performance Testing Tools for developing self-test and positioning performance bottlenecks to help testers complete "performance benchmarks, competitor testing."

APT provides real-time graph of CPU utilization , real-time graph of multi-dimensional memory, easy to compare test and locate memory leak problem, support process memory composition analysis, support automatic dump (dump) detailed heap memory object information when manual or exceed threshold value. Support multi-process, support to generate and export log diagrams in common format.

APT has the following 2 major features compared to similar tools:

①, using Java language development, based on Eclipse, cross-platform, support Windows, Linux and Mac;

②, supports simultaneous monitoring of multiple processes.

Second, APT environment construction:

Enter https://code.csdn.net/Tencent/apt, download apt compression pack

After the download is complete, unzip the. zip package, copy the inside Apt_eclipse_plugin_1.1.8.jar file to the Plugins folder under the Eclipse installation directory , and then restart Eclipse. Select "window→open perspective→other"and choose apt to start apt.

Three, Apt Page setup introduction:

 1, setting Introduction:

  Preferred page: controls the current test content (it is recommended to test each item to prevent test data from being affected);

  CPU: can set sampling interval, CPU share acquisition method, provide top and Dumpsys cpuinfo two ways;jiffies statistic Switch , Can accurately quantify the CPU time slice consumption, suitable for standby power consumption test ;

  Memory: can set the acquisition interval, auto dump (dump) memory snapshot switch, auto dump (dump) memory snapshot threshold, can set the memory type curve display switch, which can be dynamically adjusted during the test.

  

 2. List of apt processes:

List of tested processes: The process of testing/preparing tests (whether to start testing by the control buttons on the right of the process list);

Run the process list: Test all the processes that the device has run, double-click in the list or right-add the process to be tested (multiple selection supported );

Start/pause button: Controls the start and pause of the test;

Refresh button: Update the status of your phone and the list of processes on your phone;

Open log: Open the log generated by apt and regenerate the graph;

Open the folder where log is stored.

  

 

Iv. CPU and memory testing:

 1, CPU test : First set the CPU sampling interval and data source parameters ( sampling interval According to the actual need to set, the data source can default top), and then select the process to test to start the test, the process corresponding to the application to operate, will be:

 2. Memory Test : First set sampling interval and "Dump Hprof"-select "Yes" to get memory automatically, select "No" to get memory snapshot manually.

When the monitored process memory exceeds the set threshold , the memory snapshot hprof file for the current process is automatically saved. memory snapshots. hprof files are saved in the user root directory \apt\log\hprof directory, and the analysis is opened with the MAT .

  

In the list of processes , right click on the application process under test, select "PMAP", memory snapshot is saved in: User root directory \apt\log\ directory "package name _PID_PMAP_ time Stamp".

 To view a snapshot: Click the Eclipse toolbar windows→showview→other, select apt View pmap, and click Open Snapshot file in Pmap view.

Five, the matters needing attention:

1. The DUMPHPROF and GC functions in APT have two limitations due to the use of ddmlib function;

2, to ensure that the mobile phone system or the application is to be tested can be debugged;

3, Ddmlib does not allow multiple tools at the same time to get the process information on the debug phone, so if you want to use APT's two functions, it is best to switch the eclipse perspective to apt, and then restart Eclipse;

4. Obtaining the Pmap file requires root access and requires a default root. If you enter adb shell By default is not root, you can first execute adb root ;

5. It is best to add adb path to path;

6. Eclipse requires the installation of the ADT plugin.

Test Android app performance with apt

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.