Android Performance monitoring
First, build the Android performance test environment, see the "Android performance test Monkey use " content.
Second, start the Android virtual machine, you can start through eclipse, or you can start by command:
1. View the virtual machine created by the Android list avd command;
2, through the command emulator @name start the virtual machine;
Three, memory acquisition
1, through the Dumpsys to take the value, you can see all the process memory information, the command is as follows:
ADB Shell Dumpsys Meminfo
2. To view detailed memory information, the command is as follows:
adb shell dumpsys meminfo $pakagename or $Pid
Such as:adb shell dumpsys meminfo 1019
You can see that the native heap and Dalvik heap occupy the size of the heap size column, Dalvik heap is the heap memory that is often said, the Dalvik heap cannot exceed the maximum limit, and oom may occur when the maximum limit for a single program memory is exceeded.
To view the maximum memory limit command:
adb shell getprop|grep heapgrowthlimit
Get results:
| [Dalvik.vm.heapgrowthlimit]: [96m] The maximum limit for a single program memory is 96M.
3, use/system/xbin/procrank to view memory information, the command is as follows:
adb shell procrank
Vss–virtual Set Size Virtual memory consumption (contains memory consumed by shared libraries)
Rss–resident Set Size actually uses physical memory (contains memory consumed by shared libraries)
Pss–proportional Set Size Actual physical memory used (proportional allocation of memory consumed by shared libraries)
Uss–unique the Set Size process consumes the physical memory alone (does not contain the memory occupied by the shared library)
USS is the case of a process started suspicious memory leaks, is a program started the resulting virtual memory, once the program process is killed will be released!
Iv. CPU Monitoring
1. View CPU usage of the top 5 processes
ADB shell top-m 5-s CPU
To see the top 5 CPU-intensive processes (-t display process name,-s sort by the specified row,-n refreshes several times before exiting,-D refresh interval,-m displays the maximum number)
2. CPU Data collection
adb shell dumpsys cpuinfo
The CPU usage is 60%, where the user is 45% and the kernel consumes 15%.
If you want to filter the specified app, use the following command:
Five, flow monitoring
1, find the application of the PID test
adb shell ps
The PID of the application Com.gewara was found to be 1970;
使用命令:
adb shell cat /proc/$Pid/net/dev
查看流量信息;
Example: adb shell cat /proc/
1970/net/dev
You can see the number of bytes sent, if it is an online test, the Wlan0 column will be displayed, indicating the WiFi upload download identity, the upload volume is byte, the mobile mode on/off, can initialize the Wlan0 data.
Power Capture Command:
adb shell dumpsys battery
Note: If you cannot use the grep command, download the Install Cygwin tool.
Android Performance monitoring