如何使用Android系統工具統計監控磁盤IO讀寫


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM