Someone (forget who) mentioned recently that you could get some "poor
man's" profiling info by attaching to a running python with gdb, and
periodically grabbing a stack trace.

I figured out that there's a handy way to do this with this command:

    watch -n 1 'pstack 30154 | tac'

which will show a full-screen stack dump once per second on the python
with pid 30154.  (It works with non-Python, too--the 'p' is apparently
for "process", not "python".)

If the interesting part runs off the bottom of your screen, you can
always leave off the tac, though that makes it a bit jumpier.

(pstack uses the ptrace interface, which may annoy the parents of this
process if they're paying attention (which is not usually the case).)

Have fun,
Mike
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to