Android monkey监视系统状态

来源:互联网 发布:地瓜网络嗅探器插件 编辑:程序博客网 时间:2024/05/17 05:03

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/shwhile [ 1 ]doecho "uptime"uptimeecho "cat /proc/cpuinfo"cat /proc/cpuinfoecho "top -n 1 -d 1 -m 30 -t"top -n 1 -d 1 -m 30 -techo "procrank"procrankecho "cat /proc/vmstat"cat /proc/vmstatecho "cat /proc/vmallocinfo"cat /proc/vmallocinfoecho "cat /proc/slabinfo"cat /proc/slabinfoecho "cat /proc/zoneinfo"cat /proc/zoneinfobusybox sleep 60done


原创粉丝点击