CPU and memory consumption of Android app performance test

Source: Internet
Author: User

Recently found himself learning a lot of things did not do well in the accumulation of work , but also initiated the idea of writing something. I also do not write the habit of blogging, the bottom of the mobile phone to write the performance test .

Recently the company, want us to engage in the performance test of the competition, I am responsible for CPU and memory performance test, and then share with you the Android application CPU and memory performance test.

Let's start with a little analysis of the test environment: we know that CPU and memory consumption is a real-time change, and no specific Android app on the market can monitor CPU and memory consumption in real time and use log logs to save. Considering that Android's underlying framework is a Linux -based platform, we can monitor the Android platform's resources in real time through Linux resource monitoring commands.

To achieve the above test environment, the following points are required:

1. The tested phone has root privileges: because it involves the underlying Linux command, it needs to read or execute the corresponding file. As for how to root your phone, different models of the phone root method is not the same, here do not introduce. Specifically, you can search the web for your own phone model root tutorial, here do not introduce.

2, need to build an Android development environment: Because we need to monitor a specific application resource usage, so you need to know the application of the corresponding "Installed package name" is what, this need to use the Android development environment in the DDMS module devices in the view, When the tested software is started, the installation package name of its main application will generally appear at the bottom of the list (except for Google Maps, etc., boot up).

Through the above we can see Baidu Map of the main package named: Com.baidu.BaiduMap

Due to the limited space, the specific Android development environment of the construction process, you can see the network of tutorials, here is not to repeat.

3, through the Linux command monitoring. The front is some initial preparation conditions, the bottom is actually the actual operation flow:

(1) ADB shell (enter Linux on the ground floor)

(2) Echo 3>/proc/sys/vm/drop_caches (Erase system cache)

(3) top-d 1 | grep Com.baidu.BaiduMap (take Baidu map for example, print once per second resource utilization)

What does each column above mean? Because of the way the compound query "pipe break" is used, you must have root privileges, otherwise grep commands are not recognized.

Here we see that CMD does not show the title of the corresponding column, so we can use the top command alone to learn:

As for the meaning of the above columns I do not say I think you should also guess, here only to say that we need to use the two parameters, the other can be online query to understand:

|--CPU%:CPU occupancy Rate

|--rss: Actual amount of physical memory consumed, in kilobytes

We can print out different "tags" for different businesses, to differentiate the business that we are currently engaged in, and to analyze CPU and memory usage and comparisons in each business module for later analysis.

Above is the data obtained for the evaluation of a specific Android app, we copy the log into Excel table and draw the corresponding data table.

Finally, according to the obtained chart performance analysis (a variety of similar software to compare), the company's software to obtain the evaluation criteria come out.

Do you have any opinion, please make bricks in time ~

CPU and memory consumption of Android app performance test

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.