3đź‘Ť
you can connect to the process and attach a debugger. i have done this before and it’s very useful. my full notes are here, but the abridged version is:
-
install this so that gdb “understands” python
-
connect using
gdb -p PID
(PID
fromps
or similar) -
generate a stack trace in gdb and you’ll see exactly where you are eating up CPU.
original credit – Showing the stack trace from a running Python application (in fact, after typing all that, maybe this is a dupe of the linked question? i guess the question is different, even if the answer is the same…)
👤andrew cooke
Source:stackexchange.com