OSX-如何查看进程中所有线程的TID? [英] OSX - How can I see the TID of all threads from my process?
本文介绍了OSX-如何查看进程中所有线程的TID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Linux上,ps -eLf | grep my-process-name
给出了我进程中的线程列表以及每个线程的TID.
在OSX上,ps -M pid
提供了线程列表,但未显示每个线程的TID.
如何从命令行在单个进程下查看线程TID?
解决方案
在Mac OS上看不到带有ps
的TID,因为您在使用ps L
列出所有可能的列选项时会遇到这种情况.>
无论如何,如果您不介意以root用户身份浏览线程,则可以使用 解决方案
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
这篇关于OSX-如何查看进程中所有线程的TID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文