Android monkey監視系統狀態

When monkey tests are running in android phones, phones have memory leakage and are difficult to trace system status,

although logcat, kernel log can provide some information.


Android limitation

  • Linux crond is not supported
  • Even if busybox tool package is available, ithas incomplete bash or sh shell capability.

One simple workaround script is provided here to monitor system status in given time interval.

The basic idea is

  1.  push script to phone
    adb push monitor.sh /
  2. grant execution mode ( root needed)
    chmod 0777 monitor.sh
  3. start script execution from PC side
    adb shell sh monitor.sh > monitor_log.txt
  4. start normal monkey test
  5. monitor_log.txt can be analyzed after monkey test is finished


#!/bin/sh

while [ 1 ]
do
	echo "uptime"
	uptime

	echo "cat /proc/cpuinfo"
	cat /proc/cpuinfo

	echo "top -n 1 -d 1 -m 30 -t"
	top -n 1 -d 1 -m 30 -t
	
	echo "procrank"
	procrank

	echo "cat /proc/vmstat"
	cat /proc/vmstat

	echo "cat /proc/vmallocinfo"
	cat /proc/vmallocinfo

	echo "cat /proc/slabinfo"
	cat /proc/slabinfo

	echo "cat /proc/zoneinfo"
	cat /proc/zoneinfo

	busybox sleep 60
done


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章