Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@channprj
Last active August 5, 2020 01:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save channprj/ac9f4dd8d6d76cfc4c04e8de7319471e to your computer and use it in GitHub Desktop.
Save channprj/ac9f4dd8d6d76cfc4c04e8de7319471e to your computer and use it in GitHub Desktop.
실행중인 파이썬 프로세스 모니터링하기

실행중인 파이썬 프로세스 모니터링하기

사전준비

pip install pyrasite urwid meliae

사용방법

아래와 같이 pid 확인 후 pyrasite-shell 실행

ps aux | grep python
pyrasite-shell 12345

이후 아래와 같이 예시 코드를 실행하면 현재 프레임 확인 가능

import sys, traceback

for thread, frame in sys._current_frames().items():
    print('Thread 0x%x' % thread)
    traceback.print_stack(frame)
    print()

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment