python pystack
Posted tongyishu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python pystack相关的知识,希望对你有一定的参考价值。
pystack 用于查看 python 的调用栈信息,与 C 语言的 pstack 和 gstack 功能相似。
使用
pystack 4747 # 查看进程 4747 调用栈的信息,不打印线程号
pystack 4747 -v # 查看进程 4747 调用栈的详细信息,打印线程号。如下所示,4个线程号分别对应4个python调用栈
Standard Output:
[New LWP 5126]
[New LWP 5092]
[New LWP 5088]
[New LWP 5087]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f252348bf73 in select () from /lib64/libc.so.6
$1 = (void *) 0x1
Standard Error:
Dumping Threads....
File "/usr/lib/python2.7/site-packages/tuned/exports/dbus_exporter.py", line 154, in _thread_code
self._main_loop.run()
File "/usr/lib64/python2.7/site-packages/gi/overrides/GLib.py", line 574, in run
super(MainLoop, self).run()
---------------
File "/usr/lib/python2.7/site-packages/pyudev/monitor.py", line 402, in run
for fd, _ in eintr_retry_call(notifier.poll):
File "/usr/lib/python2.7/site-packages/pyudev/_util.py", line 167, in eintr_retry_call
return func(*args, **kwargs)
---------------
File "/usr/lib64/python2.7/threading.py", line 622, in wait
self.__cond.wait(timeout, balancing)
File "/usr/lib64/python2.7/threading.py", line 362, in wait
_sleep(delay)
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
---------------
File "/usr/lib64/python2.7/threading.py", line 622, in wait
self.__cond.wait(timeout, balancing)
File "/usr/lib64/python2.7/threading.py", line 362, in wait
_sleep(delay)
/usr/local/bin/pip3 install pystack-debuger
以上是关于python pystack的主要内容,如果未能解决你的问题,请参考以下文章