Android performance test some code review and performance testing tools for Android Studio

Source: Internet
Author: User

Introduction:

Android applications in CPU usage, memory consumption performance indicators are important factors affecting product quality, because QQ Butler, 360 mobile phone assistants and other applications provide intuitive memory consumption, traffic monitoring functions, resulting in users more attention than ever to the performance of software, and to make software selection decision.

For now, there are a lot of tools that can monitor the performance of Android apps for developers to use. Such as: Based on the Eclipse plug-in system mat, which is generated by the. hprof file to troubleshoot memory leaks; memory Detection Tool APT: Provides a real-time graph of CPU utilization for easy control of memory leaks [figure 0-1]

Figure 0-1 Real-time monitoring of memory and CPU usage in Android apps via apt

At the moment, the most mature Android performance monitoring tools are often in the Eclipse-adt era. And in Android-studio's increasingly stable now, Android developers have a better choice (thinking back 3 years ago with the first version number of Android studio, compared to the present than already), from Google's website no longer provides the ADT integrated development of the download can be seen, Android-studio is already the trend. This paper summarizes several of the Android quality control tools for Android-studio

A lint for Android studio tool

Before a performance test, the project source code is first misspelled and tuned. Android Lint is able to review the possible problems of androidproject by scanning and checking. It is a static testing tool. Ensure program quality before the app is advertised by discovering issues that may exist in your code. Early lint tools were able to integrate with eclipse. Now Android-studio has built this tool.

You can open the tool by right-clicking->analyze->inspect code on the project header.



Figure 1-1 Calling Lint in Android-studio

Android Lint can check out the errors contained in:

    1. Missing translations (and unused translations) no translated text
      2. Layout performance problems (all the issues the old layoutopt tool used to find, and more) layouts performance
      3. Unused resources not used by redundancy
      4. Inconsistent array sizes (when arrays is defined in multiple configurations) the size of the arrays in multiple configurations is inconsistent with the file
      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 the error message. Be able to see the details of the error and the location in the code.

(the error here is often not an exception or an error, but a part of your code that can be further optimized.)

Figure 1-2 Optimizing code with Android Studio lint

With no problem with the code, you can run the program up for the next memory and CPU monitoring.

Two Memory Monitor

Memory Monitor is a performance analysis tool provided by Android Studio that gives you an intuitive view of your Android app's RAM and CPU usage.

After the program executes. Observe the following views for example at the bottom of the IDE:

Figure 2-1 Memory Monitor View (1)

It is now possible to operate on the AVD or on the real machine accordingly. The memory monitor reflects the CPU and memory changes that are currently being generated by the operation.

Figure 2-2 Memory Monitor view (2)

As Android has just started to learn the feeling android-studio built-in monitoring tools are very intuitive and powerful, do not know in the future will not be exposed to more excellent open-source performance test project. As a drawback, android-studio monitoring function can not be output, so it is not convenient statistics and cross-control. At the same time. Monitoring of traffic is not included.

The following is an open source project that can output a form and execute Yujieng/simulator directly: Emmagee

Three Android Performance test tool: Emmagee

The Emmagee features include:

    • Detects the CPU usage and overall usage consumed by the measured application
    • The memory footprint and percentage of the measured application
    • Measured traffic consumption

The real drawback of the project is that it is not an embedded tool. It's a separate app. So it is completely independent of the development environment.

Git Address: Https://github.com/kevinkong/Emmagee

APK Address: Http://code.google.com/p/emmagee/downloads/list

How to use:

    • Start Emmagee
    • Select the Monitored program
    • Operation of the monitored program
    • Back to Emmagee interface, end monitoring
    • Export Results Form

Emmagee interface For example as seen, I choose to monitor one of my own app:alicom-in.



Figure 3-1 Emmagee start-up interface

After the test is started, the application will start on its own initiative. It is possible to perform some operations on the measured application, then return to the Emmagee interface and choose to end the application.

The resulting form is saved to the specified folder.

Figure 3-2 Emmagee End Recording

Use Excel to open the form.

Table 3-1 Emmagee Output results

This form can be analyzed by using the table tool that comes with Excel. can also be further compared to the test results of different apps.

Figure 3-3 using Excel to visually observe the test results of each indicator

Iv. Summary and Outlook

Android App performance metrics are a focus for developers and users. In order to carry on the technical reserve to the future client development work. Provides a prior knowledge of the team and today understands the performance assurance tools for Android Studio. Contains:

1 Android Studio Static code review tool lint

2 Android Studio memory, CPU real-time monitoring tool memories Monitor

3 Android App data statistics tool Emmagee

These three tools have the ability to initially support Android developers ' attention to program performance. At the same time, there are some deficiencies. For example, memory monitor and emmagee need to complement each other's shortcomings, assuming that there is a tool that can monitor both real-time and output forms (including traffic monitoring results). is better. In addition, although the Emmagee tool can be used to view the performance of the entire application, but the details of which function or service caused the performance problem, it is necessary to further troubleshooting developers. When the demand is not only performance control. But when performance tuning is required. Such a function of the shortcomings can not be ignored.

In fact, today also learned that there is another tool: Traceview. It is possible to count the impact of the application performance of each function by setting a monitoring breakpoint before and after the key code. This will play a key role in improving application performance, and is also the focus of my next study.

References:

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

2 "Introduction to the Performance Tuning tool for Android system" http://www.atatech.org/articles/16013

3 "Android Performance Test Tool Emmagee Introduction" http://blog.163.com/[email protected]/blog/static/121650342201312551147909/

4 "Android Performance Test tool: Emmagee" http://www.open-open.com/lib/view/open1367026451078.html

Android performance test some code review and performance testing tools for Android Studio

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.