在Android系统,应用的开发过程中,有时候我们希望对系统,或者应用的性能有一个比较全面的了解。
AndroidStudio提供了相应的Profile工具,可以很方便的查看CPU,内存,电池等信息,但是有时候在处理一些ANR问题时候,我们希望了解应用或者系统磁盘IO的一个情况。
AOSP源码中提供了一个iotop工具,代码路径
system/extras/iotop/
这个工具默认没有编译到系统中,需要我们手动编译,然后push到设备上
# make iotop
. build/env_setup.sh
lunch your_device
make -j20
mmm system/extras/iotop/
# push to device
adb push out/target/product/your_device/system/bin/iotop /data/local/tmp/
adb shell
cd /data/local/tmp/
chmod a+x iotop
# run iotop
# "Usage: %s [-h] [-P] [-d <delay>] [-n <cycles>] [-s <column>]\n"
# " -a Show byte count instead of rate\n"
# " -d Set the delay between refreshes in seconds.\n"
# " -h Display this help screen.\n"
# " -m Set the number of processes or threads to show\n"
# " -n Set the number of refreshes before exiting.\n"
# " -P Show processes instead of the default threads.\n"
# " -s Set the column to sort by:\n"
# " pid, read, write, total, io, swap, faults, sched, mem or delay.\n",
#
./iotop -a -P | grep minimap
---- IO (KiB) ---- ----------- delayed on ----------
PID Command read write total IO swap sched mem total
2381 utonavi.minimap 4 68 72 0.00% 0.00% 0.00% 0.00% 0.00%
2381 utonavi.minimap 0 0 0 0.00% 0.00% 0.00% 0.00% 0.00%
2381 utonavi.minimap 0 0 0 0.00% 0.00% 0.00% 0.00% 0.00%
2381 utonavi.minimap 0 0 0 0.00% 0.00% 0.00% 0.00% 0.00%
2381 utonavi.minimap 0 0 0 0.00% 0.00% 0.00% 0.00% 0.00%
2381 utonavi.minimap 120 68 188 0.00% 0.00% 0.00% 0.00% 0.00%
2381 utonavi.minimap 72 48 120 0.00% 0.00% 0.00% 0.00% 0.00%
