Android performance testing some code review and performance testing tools for Android Studio, android Performance Testing

Source: Internet
Author: User

Android performance testing some code review and performance testing tools for Android Studio, android Performance Testing

 

Introduction:

The CPU usage and memory consumption performance indicators of Android applications are important factors affecting product quality. Because QQ manager and 360 mobile assistant provide intuitive memory consumption and traffic monitoring functions, as a result, users are more concerned with the performance of the software than before, and therefore choose the software.

Currently, many tools are available for developers to monitor the performance of android apps. For example, MAT Based on the Eclipse plug-in system is generated. the hprof file is used to check the memory leakage. The memory detection tool APT: provides a real-time CPU utilization curve to facilitate the comparison of the Memory leakage test problems [figure 0-1]

Figure 0-1 use APT to monitor the memory and CPU usage of android applications in real time

 

Currently, the most mature android performance monitoring tools are often found in the eclipse-ADT era, android Developers already have a better choice (the first version of android studio used three years ago is different from the current version ), android-studio is the trend of the times. This article summarizes several android quality control tools for android-studio.

 

A lint for android studio Tool

Before performance testing, you must first troubleshoot and optimize the engineering source code. Android Lint can review possible problems in the Android project through scanning and checking. It is a static testing tool, ensure program quality before application release by discovering possible problems in the code. Early lint tools can be integrated with Eclipse. Now android-studio has built in this tool. You can right-click the project title-> Analyze-> Inspect Code to open the tool.

Figure 1-1 call lint in android-studio

Android Lint can check the following errors:

  1. Missing translations (and unused translations) Text not translated
    2. Layout performance problems (all the issues the old layoutopt tool used to find, and more) Layout performance
    3. Unused resources Unused redundant resources
    4. Inconsistent array sizes (when arrays are defined in multiple configurations) Inconsistent array size files in multiple configurations
    5. Accessibility and internationalization problems (hardcoded strings, missing contentDescription, etc)
    6. Icon problems (like missing densities, duplicate icons, wrong sizes, etc)
    7. Usability problems (like not specifying an input type on a text field)
    8. Manifest errors

Double-click error information to view details about the error and its location in the code. (Errors here are often not exceptions or errors, but parts of your code that can be further optimized)

Figure 1-2 Use android studio lint to optimize code

 

After the code is correct, you can run the program to monitor the memory and CPU in the next step.

 

2. Memory Monitor

 

Memory Monitor is a performance analysis tool provided by android studio. It intuitively shows the Memory and CPU usage of android applications in the view.

After the program runs, observe the following view at the bottom of the IDE:

Figure 2-1 Memory Monitor view (1)

Now you can operate applications on avd or on a real machine. Memory Monitor can reflect the CPU and Memory changes caused by the current operation.

Figure 2-2 Memory Monitor view (2)

 

As a beginner of Android, I feel that the built-in monitoring tool of android-studio is very intuitive and powerful. I don't know if I will be able to access more excellent open-source performance testing projects in the future. As a weakness in the United States, the monitoring function of android-studio cannot be output, so it is not convenient for statistics and horizontal comparison. At the same time, traffic monitoring is not included. The following describes an open-source project that can output forms and run directly on a real machine/simulator: Emmagee

 

3. Android Performance Testing Tool: Emmagee

 

Emmagee functions include:

  • Detects the CPU usage and total usage of the tested application.
  • Detect memory usage and percentage of tested applications
  • Detect traffic consumption

 

The real disadvantage of Project change is that it is not an embedded tool, but a separate app. Therefore, it is completely independent from the development environment.

Git address: https://github.com/kevinkong/Emmagee

Apk: http://code.google.com/p/emmagee/downloads/list

Usage:

  • Start Emmagee
  • Select monitored programs
  • Operations on Monitored programs
  • Return to the Emmagee page to end monitoring.
  • Export result form

 

As shown in the Emmagee interface, I chose to monitor my own app: alicom-in.

Figure 3-1 Emmagee startup page

After the test starts, the tested application starts automatically. Here, you can perform some operations on the tested application, return to the Emmagee interface, and choose to end the application. The result form is saved to the specified directory.

Figure 3-2 End recording of Emmagee

Open the form in excel.

Table 3-1 Emmagee output results

You can use the table tool in excel to analyze the form or compare the test results of different apps.

Figure 3-3 use excel to visually observe the detection results of each indicator

 

Iv. Summary and prospects

 

Android Application Performance indicators are the focus of developers and users. In order to reserve technical resources for future client development work and provide the team with prior knowledge, today I learned about the performance guarantee tool for Android Studio. Including:

1 android studio static code review tool lint

2 android studio Memory, CPU Real-time Monitoring Tool Memory Monitor

3. Emmagee

 

These three tools initially support android Developers to focus on program performance. At the same time, there are also some shortcomings. For example, Memory Monitor and Emmagee need to complement each other. If a tool can both Monitor in real time and output forms (including traffic monitoring results ), that's better. In addition, although the Emmagee tool can observe the performance indicators of the entire application, but the specific function or service causes performance problems, developers need to further troubleshoot. When performance tuning is not only required for performance control, but also for performance optimization, the shortcomings of this function cannot be ignored.

 

In fact, today I also learned another tool: Traceview, which can count the impact of various functions on application performance by setting monitoring breakpoints before and after key code, this will play a key role in improving application performance and will be my next step.

 

References:

1 Performance Test-Android http://www.atatech.org/articles/36920

2 Android system performance tuning tools introduction http://www.atatech.org/articles/16013

3 Introduction to Android Performance Testing Tool Emmagee http://blog.163.com/rettar@126/blog/static/121650342201312551147909/

4 The Android Performance Testing Tool: Emmagee http://www.open-open.com/lib/view/open1367026451078.html

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.