1. 查看所有进程信息:
adb shell ps -A
则得到:
USER PID PPID VSZ RSS WCHAN ADDR S NAME
root 1 0 12510356 5276 ep_poll 0 S init
root 2 0 0 0 kthreadd 0 S [kthreadd]
...
system 603 1 12539680 3468 ep_poll 0 S servicemanager
...
system 1065 879 23323448 443428 ep_poll 0 S system_server
....
可以看出 :
PID 1065 对应的是 system_server进程
PID 603? 对应的 servicemanager 进程 (用于Binder 通信)
2. 查看某个进程下的所有线程信息:
adb shell ps -T [PID]
如查看上面 system_server 进程下的所有线程信息:
adb shell ps -T 1065
则得到:
USER PID TID PPID VSZ RSS WCHAN ADDR S CMD
system 1065 1065 879 23323448 431900 ep_poll 0 S system_server
system 1065 1089 879 23323448 431900 do_sigtim+ 0 S Signal Catcher
system 1065 1090 879 23323448 431900 pipe_read 0 S perfetto_hprof_
system 1065 1097 879 23323448 431900 poll_sche+ 0 S ADB-JDWP Connec
system 1065 1098 879 23323448 431900 futex_wai+ 0 S Jit thread pool
system 1065 1099 879 23323448 431900 futex_wai+ 0 S HeapTaskDaemon
system 1065 1100 879 23323448 431900 futex_wai+ 0 S ReferenceQueueD
system 1065 1101 879 23323448 431900 futex_wai+ 0 S FinalizerDaemon
system 1065 1102 879 23323448 431900 futex_wai+ 0 S FinalizerWatchd
system 1065 1110 879 23323448 431900 binder_io+ 0 S Binder:1065_1
system 1065 1112 879 23323448 431900 binder_io+ 0 S Binder:1065_2
system 1065 1158 879 23323448 431900 futex_wai+ 0 S Thread-2
system 1065 1200 879 23323448 431900 ep_poll 0 S android.fg
system 1065 1201 879 23323448 431900 ep_poll 0 S android.ui
system 1065 1202 879 23323448 431900 ep_poll 0 S android.io
system 1065 1203 879 23323448 431900 ep_poll 0 S android.display
system 1065 1204 879 23323448 431900 ep_poll 0 S android.anim
system 1065 1205 879 23323448 431900 ep_poll 0 S android.anim.lf
system 1065 1227 879 23323448 431900 futex_wai+ 0 S watchdog
system 1065 1233 879 23323448 431900 ep_poll 0 S android.bg
system 1065 1235 879 23323448 431900 binder_io+ 0 S HwBinder:1065_1
system 1065 1236 879 23323448 431900 ep_poll 0 S ActivityManager
system 1065 1237 879 23323448 431900 ep_poll 0 S ActivityManager
system 1065 1242 879 23323448 431900 ep_poll 0 S ActivityManager
system 1065 1243 879 23323448 431900 ep_poll 0 S ActivityManager
...
具体参考:
Android重要线程进程一览 - 掘金
|