def threadDump(signum, frame):
"""Signal handler for dumping thread stack frames to stdout."""
print
print "App server has been signaled to attempt a thread dump."
print
print "Thread stack frame dump at", asclocaltime()
sys.stdout.flush()
frames = sys._current_frames()
print
print "-" * 79
print
for threadID in sorted(frames):
frame = frames[threadID]
print "Thread ID: %d (reference count = %d)" % (
threadID, sys.getrefcount(frame))
print ''.join(traceback.format_list(traceback.extract_stack(frame)))
print "-" * 79
sys.stdout.flush()
评论列表
文章目录