我正在尝试监控进程的线程列表。我希望可以通过ADB Shell查看它。我知道列出进程的方法:
adb shell ps -p
但是如何进一步查看该进程的线程?
使用:Android 4.4.2
我正在尝试监控进程的线程列表。我希望可以通过ADB Shell查看它。我知道列出进程的方法:
adb shell ps -p
但是如何进一步查看该进程的线程?
使用:Android 4.4.2
您可以使用 adb shell ps --help
查找所需选项。一种方法是使用 adb shell ps -T | grep <PID>
,其中 <PID>
是线程 ID。您可以使用 adb shell ps -A
找到它。
在 Windows 10 上的示例:
PS C:\Users\languoguang> adb shell ps -A | findstr "system_server"
system 3107 1218 14800384 722996 do_epoll_wait 0 S system_server
PS C:\Users\languoguang> adb shell ps -T | findstr "3107" | findstr "Input"
system 3107 3332 1218 14800384 723868 do_epoll_wait 0 S InputDispatcher
system 3107 3333 1218 14800384 723868 do_epoll_wait 0 S InputReader
PS C:\Users\languoguang>
-T
是用于线程的参数,而不是进程的参数。 - undefinedps -t
。这样就可以解决问题了。adb shell ps -t
显示附加到 TTY 的进程。adb shell ps -T
显示线程。(请注意大写字母。) - Arto Bendikenps
实现的旧版 Android 使用 -t
作为线程。 - hesham_EE