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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值