Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ADB Shell ~ How to List a Process' Threads?

I'm trying to monitor the list of threads a process has. I'm hoping it can be viewed via ADB Shell. I am aware of listing the process:

adb shell ps -p

But how do i go an extra layer deeper for that process' threads?

Using: Android 4.4.2

like image 377
user2522885 Avatar asked Jun 26 '26 02:06

user2522885


2 Answers

You can find the option you need using adb shell ps --help. One way is to use adb shell ps -T | grep <PID>, where <PID> is the thread ID. You can find it using adb shell ps -A

Example on 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>
like image 73
fdermishin Avatar answered Jun 28 '26 17:06

fdermishin


The command you are looking for is ps -t. That would do the trick.

like image 45
Storo Avatar answered Jun 28 '26 17:06

Storo