打印python进程堆栈,python进程堆栈,import threa
打印python进程堆栈,python进程堆栈,import threa
import threading, sys, tracebackdef dumpstacks(signal, frame): id2name = dict([(th.ident, th.name) for th in threading.enumerate()]) code = [] for threadId, stack in sys._current_frames().items(): code.append("\n# Thread: %s(%d)" % (id2name.get(threadId,""), threadId)) for filename, lineno, name, line in traceback.extract_stack(stack): code.append('File: "%s", line %d, in %s' % (filename, lineno, name)) if line: code.append(" %s" % (line.strip())) print "\n".join(code)import signalsignal.signal(signal.SIGQUIT, dumpstacks)
有关signal模块的使用请参考: https://docs.python.org/2/library/signal.html
相关内容
- Python urldecode 函数,pythonurldecode,import urlli
- Python 随机产生大量md5,python产生md5,import strin
- python 的datetime.timedelta表示成可读的时间段,,def getWor
- Rock-paper-scissors-lizard-Spock Game,,# The key id
- getEncodedRange 方法一例,,import chilk
- 查百度关键词排名,百度关键词排名,#查询指定网站百
- Python爬虫程序获取百度搜索结果的标题、描述、url。,
- 比较两个文本的相似性,分词版。,相似性分词,比较两
- 百度图片下载,,#coding:utf-
- 翻番的力量,翻番力量,你要上帝一次性给你 1
评论关闭