adb shell top 使用


adb shell top 

一、其中相關參數:

  1. >adb shell top -h
  2.  Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [-t ] [ -h ]
  3.  -m num Maximum number of processes to display. 最多顯示多少個進程
  4.  -n num Updates to show before exiting. 刷新次數
  5.  -d num Seconds to wait between updates. 刷新間隔時間(默認5秒)
  6.  -s col Column to sort by (cpu,vss,rss,thr). 按哪列排序
  7.  -t Show threads instead of processes. 顯示線程信息而不是進程
  8.  -h Display this help screen. 顯示幫助文檔

比如:

adb shell top -m  5

表示打印出5個進程數,以及相關進程運行所消耗的CPU值百分比。

第一欄相關參數解釋:

  1. User 處於用戶態的運行時間,不包含優先值為負進程
  2.  Nice 優先值為負的進程所占用的CPU時間
  3.  Sys 處於核心態的運行時間
  4.  Idle 除IO等待時間以外的其它等待時間
  5.  IOW IO等待時間
  6.  IRQ 硬中斷時間
  7.  SIRQ 軟中斷時間PID 進程id

第二欄相關參數解釋:

  1. PID 進程id
  2.  PR 優先級
  3.  CPU% 當前瞬時CPU占用率 
  4. S 進程狀態:D=不可中斷的睡眠狀態, R=運行, S=睡眠, T=跟蹤/停止, Z=僵屍進程
  5.  #THR 程序當前所用的線程數
  6.  VSS Virtual Set Size 虛擬耗用內存(包含共享庫占用的內存)
  7.  RSS Resident Set Size 實際使用物理內存(包含共享庫占用的內存)
  8.  PCY 調度策略優先級,SP_BACKGROUND/SP_FOREGROUND
  9.  UID 進程所有者的用戶id
  10.  Name 進程的名稱

二、命令使用  

  1. adb shell top -m xx  查看XX個進程數
  2. adb shell top -n XX  刷新XX次
  3. adb shell top -d XX  刷新頻率
  4. ……

三、打印出來的數據保存到本地

  adb shell top -m 5 > d:\cpu.txt  表示打印的5個進程的數據保存到本地D盤的cpu.txt文件中

四、指定查看某個應用的數據

  例如: 監測一次微博的CPU占用情況:adb shell top -n 1 | grep com.sina.weibo

     10秒刷新一次顯示CPU占用情況:adb shell top -d 10 | grep com.sina.weibo

     實時監測微博的CPU占用情況:adb shell top |grep com.sina.weibo


免責聲明!

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



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