OSX - How can I see the TID of all threads from my

2020-07-09 07:12发布

问题:

On Linux ps -eLf | grep my-process-name gives a list of the threads within my process along with the TID of each thread.

On OSX ps -M pid gives me the list of the threads but does not show the TID of each thread.

How can I see thread TIDs under a single process from the command line?

回答1:

You can't see the TIDs with the ps on Mac OS as you can experience while listing all the possible column options with ps L.

Anyway, if you dont mind exploring the threads as a root, you can use dtruss, which is primarily for processing syscall details, but it will at least show you the TIDs in the PID/LWPID (PID/THRD) column.

sudo dtruss -ap pid