在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%