Android performance optimization 5 performance analysis tool dumpsys, androiddumpsys

Source: Internet
Author: User

Android performance optimization 5 performance analysis tool dumpsys, androiddumpsys


The dumpsys tool provided by Android can be used to view the system Service information and status of interest. After the mobile phone connects to the computer, you can directly run the command line to execute adb shell dumpsys to view all supported services, but there are too many such outputs, you can use dumpsys | grep "dump of service" to display only information about the main Service.

1. List all supported commands of dumpsys

> adb shell$ dumpsys | grep "DUMP OF SERVICE"

The following is the output information on my Samsung S3 mobile phone.
C:\Windows\System32>adb shellshell@m:/ $ dumpsys | grep "DUMP OF SERVICE"dumpsys | grep "DUMP OF SERVICE"DUMP OF SERVICE AtCmdFwd:DUMP OF SERVICE CustomFrequencyManagerService:DUMP OF SERVICE DirEncryptService:DUMP OF SERVICE Exynos.HWCService:DUMP OF SERVICE Exynos.IPService:DUMP OF SERVICE FMPlayer:DUMP OF SERVICE LEDService:DUMP OF SERVICE SecTVOutService:DUMP OF SERVICE SurfaceFlinger:DUMP OF SERVICE TvoutService_C:DUMP OF SERVICE accessibility:DUMP OF SERVICE account:DUMP OF SERVICE activity:DUMP OF SERVICE alarm:DUMP OF SERVICE android.security.keystore:DUMP OF SERVICE application_policy:DUMP OF SERVICE appops:DUMP OF SERVICE appwidget:DUMP OF SERVICE audio:DUMP OF SERVICE backup:DUMP OF SERVICE battery:DUMP OF SERVICE batteryinfo:DUMP OF SERVICE bluetooth_manager:DUMP OF SERVICE bluetooth_secure_mode_manager:DUMP OF SERVICE clipboard:DUMP OF SERVICE clipboardEx:DUMP OF SERVICE commontime_management:DUMP OF SERVICE connectivity:DUMP OF SERVICE container_service:DUMP OF SERVICE content:DUMP OF SERVICE country_detector:DUMP OF SERVICE cpuinfo:DUMP OF SERVICE dbinfo:DUMP OF SERVICE device_policy:DUMP OF SERVICE devicestoragemonitor:DUMP OF SERVICE diskstats:DUMP OF SERVICE display:DUMP OF SERVICE dreams:DUMP OF SERVICE drm.drmManager:DUMP OF SERVICE dropbox:DUMP OF SERVICE edmnativehelper:DUMP OF SERVICE enterprise_license_policy:DUMP OF SERVICE enterprise_policy:DUMP OF SERVICE entropy:DUMP OF SERVICE gfxinfo:DUMP OF SERVICE hardware:DUMP OF SERVICE harmony_eas_service:DUMP OF SERVICE input:DUMP OF SERVICE input_method:DUMP OF SERVICE iphonesubinfo:DUMP OF SERVICE isms:DUMP OF SERVICE license_log_service:DUMP OF SERVICE location:DUMP OF SERVICE lock_settings:DUMP OF SERVICE log_manager_service:DUMP OF SERVICE mdm.remotedesktop:DUMP OF SERVICE media.audio_flinger:DUMP OF SERVICE media.audio_policy:DUMP OF SERVICE media.camera:DUMP OF SERVICE media.player:DUMP OF SERVICE meminfo:DUMP OF SERVICE motion_recognition:DUMP OF SERVICE mount:DUMP OF SERVICE multiwindow:DUMP OF SERVICE netpolicy:DUMP OF SERVICE netstats:DUMP OF SERVICE network_management:DUMP OF SERVICE nfc:DUMP OF SERVICE nfccontroller:DUMP OF SERVICE notification:DUMP OF SERVICE package:DUMP OF SERVICE permission:DUMP OF SERVICE phone:DUMP OF SERVICE phone_restriction_policy:DUMP OF SERVICE phoneext:DUMP OF SERVICE power:DUMP OF SERVICE remoteinjection:DUMP OF SERVICE samplingprofiler:DUMP OF SERVICE samsung.smartfaceservice:DUMP OF SERVICE scheduling_policy:DUMP OF SERVICE search:DUMP OF SERVICE sec_analytics:DUMP OF SERVICE secontroller:DUMP OF SERVICE sensorservice:DUMP OF SERVICE serial:DUMP OF SERVICE servicediscovery:DUMP OF SERVICE simphonebook:DUMP OF SERVICE sip:DUMP OF SERVICE statusbar:DUMP OF SERVICE telephony.registry:DUMP OF SERVICE textservices:DUMP OF SERVICE tvoutservice:DUMP OF SERVICE uimode:DUMP OF SERVICE updatelock:DUMP OF SERVICE usagestats:DUMP OF SERVICE usb:DUMP OF SERVICE user:DUMP OF SERVICE vibrator:DUMP OF SERVICE voip:DUMP OF SERVICE wallpaper:DUMP OF SERVICE wfd:DUMP OF SERVICE wifi:DUMP OF SERVICE wifi_policy:DUMP OF SERVICE wifip2p:DUMP OF SERVICE window:

2. How to view the help information OF specific commands we can see that there are a lot OF services. The words after the "dump of Service" keyword can be directly viewed through dumpsys + words, there is a general way to view help for each specific use.
View the help of each command. The following uses meminfo as an example:
shell@m:/ $ dumpsys meminfo -hdumpsys meminfo -hmeminfo dump options: [-a] [--oom] [process]  -a: include all available information for each process.  --oom: only show processes organized by oom adj.If [process] is specified it can be the name orpid of a specific process to dump.

Iii. Explanation of some key commands
Name Function
Account Show accounts information
Activity Display information of all activities
Cpuinfo Display CPU Information
Window Display the relationship between the keyboard, window, and them
Wifi Display wifi Information
Batteryinfo $ package_name Power Information and CPU usage time
Package packagename Obtain installation package information
Usagestats Start time of each interface
Statusbar Display status bar Information
Meminfo Memory information (meminfo $ package_name or $ pid displays memory information using the package name or process id of the Program)
Diskstats Disk Information
Battery Battery Information
Alarm Show Alarm information
   

Activity-use adb shell dumpsys to detect the window of the Android Activity Task Stack-use the adb shell dumpsys command to obtain the component of the current application
Statusbar-locate the application of the AD notification dumpsys statusbar | grep Notification = notification



Iv. References Dumpsys (Official Document)
How to discover memory usage of my application in Android
Introduction and use of dumpsys functions in android (Code Analysis)



For more Optimization-related articles, see section 3 Performance Optimization in summary of Android basic learning articles.




If God gives you two choices

Of course, select the second one!
With countless money, many people will come up with this idea, and now people live to make more money, in order to better survive. However, it would be a pity to choose the first one with only 10 years of service life. There are a lot of fun in life that have not yet been enjoyed, and there are still many things that have not been done, with family, it will make the lover suffer. how miserable it is when his parents are black-haired and white-haired? Being so cruel for money cannot be tolerated or forgiven!

[Switch] android software test log

Log files are classified into two types: Real-Time printing and status information.
Real-time printing mainly involves logcat main, logcat radio, logcat events, tcpdump, and QXDM logs on the Qualcomm platform.
The status information includes adb shell dmesg, adb shell dumpstate, adb shell dumpsys, and adb bugreport.
Explain their respective functions:
In fact, the logs captured by DDMS are logcat files like those captured by dos batch processing. The logs captured by ddms are usually in the main cache, which is the log files printed by applications. However, the advantage of ddms is that it can see the color in real time. If it is a dos batch processing, it can only be redirected to the file. It can be seen only after it is captured, not in real time.
Adb logcat-B main-v time> app. log print Application log
Adb logcat-B radio-v time> radio. log prints rf-related logs. SIM STK will also be in it, modem-related ATcommand and so on, of course, it is far from QXDM.
Adb logcat-B events-v time prints logs of system events, such as touch-screen events...
Tcpdump is very useful and can be used for TCP/IP protocols. adb shell tcpdump-s 10000-w/sdcard/capture. pcap, such as the UA profile during mms download, the APN download Using proxy when browser is surfing the internet, and the streaming-related content including UA profile.
The last is the QXDM of the Qualcomm platform. Whether it is Android or not, as long as the Qualcomm chip is used, it will be very familiar with it. Of course, if it is not a Qualcomm chip, you don't need to mention it. I don't want to talk about it much. It's rich in content, such as RF, telephone, and Internet access. All the solutions provided by Qualcomm can be grasped.
Status information: in fact, one is enough, that is, bugreport (command adb bugreport> bugreport. log ). The bread contains dmesg, dumpstate, and dumpsys. Dmesg (command adb shell dmesg> ldmesg_kernel.log) is the log of the kernel. Any problems related to the kernel, such as the driver (camera, Bluetooth, usb, Boot, etc ). Dumpstate is the system status information, which is comprehensive, including the current memory information, cpu information, logcat cache, and kernel cache of the mobile phone. The adb shell dumpsys command contains all the content about the system service. This command has more detailed usage. For example, db shell dumpsys meminfo system is used to view the memory information of the process of the system.
There are also other PV logs, which are generally written by developers themselves. They may allow you to put them in the SD card. Other deficiencies or supplements are expected for your guidance.

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.