顯示當前進程的狀態(tài)
adb shell ps
顯示結(jié)果為
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 29876 1280 SyS_epoll_ 0000000000 S /init
root 2 0 0 0 kthreadd 0000000000 S kthreadd
root 3 2 0 0 smpboot_th 0000000000 S ksoftirqd/0
root 7 2 0 0 rcu_gp_kth 0000000000 S rcu_preempt
root 8 2 0 0 rcu_gp_kth 0000000000 S rcu_sched
root 9 2 0 0 rcu_gp_kth 0000000000 S rcu_bh
root 10 2 0 0 smpboot_th 0000000000 S migration/0
root 11 2 0 0 smpboot_th 0000000000 S migration/1
root 12 2 0 0 smpboot_th 0000000000 S ksoftirqd/1
root 14 2 0 0 worker_thr 0000000000 S kworker/1:0H
root 15 2 0 0 smpboot_th 0000000000 S migration/2
root 16 2 0 0 smpboot_th 0000000000 S ksoftirqd/2
root 19 2 0 0 smpboot_th 0000000000 S migration/3
root 20 2 0 0 smpboot_th 0000000000 S ksoftirqd/3
root 23 2 0 0 rescuer_th 0000000000 S khelper
root 24 2 0 0 rescuer_th 0000000000 S netns
root 25 2 0 0 rescuer_th 0000000000 S perf
root 26 2 0 0 rescuer_th 0000000000 S smd_channel_clo
root 27 2 0 0 kthread_wo 0000000000 S dsps_smd_trans_
字段含義:
- user 進程當前用戶
- pid 進程ID
- ppid 父進程ID
- VSIZE 進程的虛擬內(nèi)存大小颁井,以KB為單位
- RSS 實際占用的內(nèi)存大小,以KB為單位
- WCHAN 進程正在睡眠的內(nèi)核函數(shù)名稱妖爷;該函數(shù)的名稱是從/root/system.map文件中獲得的。
- 進程名稱 名稱前有個大寫的S(代表進程的狀態(tài))
進程的狀態(tài):
D - 不可中斷的睡眠態(tài)。
R – 運行態(tài)
S – 睡眠態(tài)
T – 被跟蹤或已停止
Z – 僵尸態(tài)
W - 進入內(nèi)存交換(從內(nèi)核2.6開始無效)
X - 死掉的進程
< - 高優(yōu)先級
N - 低優(yōu)先級
L - 有些頁被鎖進內(nèi)存
s - 包含子進程
l - 多線程,克隆線程
+ - 位于后臺的進程組
pc的含義:
計算機中提供要從[存儲器]中取出的下一個指令地址的[寄存器]
ps 命令參數(shù):-P -p -t -x -c [pid] [name]
- -P 顯示調(diào)度策略洗出,通常是bg或fg谭确,當獲取失敗將會是un和er
- -p 顯示進程的優(yōu)先級和nice等級
- -t 顯示進程下的線程列表
- -x 顯示進程耗費的用戶時間和系統(tǒng)時間帘营,格式:(u:0, s:0),單位:秒(s)
- -c 顯示進程耗費的CPU時間 (可能不兼容Android 4.0以前的老版本系統(tǒng))
- [pid] 過濾指定的進程PID
- [name] 過濾指定的進程NAME
- ps xxx 顯示過濾指定名稱的進程
和Linux的ps不同逐哈,Linux的ps命令可以這樣子:ps -aux芬迄,Android上ps的參數(shù)并不能一起使用,如ps -txPc.