Dumpsys of Android Performance Testing Tool

Source: Internet
Author: User

Note: MAT (memory analyzer tool) is a memory usage analysis tool recommended by Google. It has comprehensive and powerful functions !!!

First, let's take a look at the functions of dumpsys:
Dumpsys is used to give information about all applications on the mobile phone and the current status of the mobile phone.
Dumpsys [Option]
Meminfo Display memory information
CPU info displays CPU Information
Account displays accounts information
Activity displays information about all activities.
Window displays the relationship between the keyboard, window, and them.
WiFi display WiFi Information
 
From G14, we can see that it obtains all information from the following services.
Currently running services:
Surfaceflinger
Accessibility
Account
Activity
Alarm
Appwidget
Assetredirection
Audio
Backup
Battery
Batteryinfo
Bluetooth
Bluetooth_a2dp
Bluetooth_hid
Bluetooth_network
Clipboard
Connectivity
Content
Cpuinfo
Device_policy
Devicestoragemonitor
Diskstats
Dropbox
Entropy
Hardware
Input_method
Iphonesubinfo
ISMs
Location
Media. audio_flinger
Media. audio_policy
Media. Camera
Media. Player
Meminfo
Mount
Netstat
Network_management
Notification
Package

Next, let's take a look at how the Android system implements dumpsys.
The dumpsys code is in mydroid/frameworks/base/cmds/dumpsys. cpp
All dump information is completed by the class that reloads the dump function in the binder:
@ Override
Protected void dump (filedescriptor FD, printwriter PW, string [] ARGs ){
...
}
The code is very simple. It is found that the information searched for dump is provided by defaultservicemanager (for the Structure Analysis of Android servicemanager, see my subsequent article) by all the services registered by the system.
Take meminfo as an example:
It is registered at the setsystemprocess function in mydroid/frameworks/base/services/Java/COM/Android/Server/AM/activitymanagerservice. java.
Srvicemanager. addservice ("activity", M );
Servicemanager. addservice ("meminfo", new membinder (m ));
...
Membinder-> processrecord-> applicationthread status in running state (mydroid/frameworks/base/CORE/Java/Android/APP/activitythread. java) to obtain the required meminfo information.

This actually involves how Android manages Linux processes and how to manage Linux processes to provide various information for the Java layer.
In short, the key is the management of package and the management of its activity cycle. It is worth further understanding.

Http://blog.csdn.net/melody_lu123/article/details/6777413

Related Article

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.