4 ms·
$ pstack PID Combine with watch $ watch pstack PID On RHEL6 pstack is in gdb RPM package. (bonus: shows all threads)
by rdtsc 15y ago
$ pstack PID
Combine with watch
$ watch pstack PID
On RHEL6 pstack is in gdb RPM package.
(bonus: shows all threads)
- jbert 15y agoYes, I've used this and it's great for anything where you want a C-stack backtrace. As a variant, if you want a language-level backtrace in an interpreted language, you can: - set up a signal handler which dumps a (perl, python, etc) level backtrace - hit the program with the signal a few times
- rdtsc 15y agoGreat idea! My Python server processes during testing handle 2 signals SIGUSR1 & SIGUSR2. SIGUSR1 : runs guppy memory usage & leak profiling (http://guppy-pe.sourceforge.net/ http://guppy-pe.sourceforge.net/) import guppy _hpy = guppy.hpy() log(...,_hpy.heapu(),...) log(...,_hpy.heap(),...) log(..., <other _hpy info>...) SIGUSR2 : open an interactive console using rconsole (http://code.google.com/p/rfoo/ http://code.google.com/p/rfoo/) and let me log and muck around with live object while the server process keeps running.[NOTE: don't use on production systems, it opens an RPC port that lets anyone control your process remotely!] from rfoo.utils import rconsole rconsole.spawn_server() Then on the console: $ rconsole
- lutorm 15y agoWow, you learn something new every day! That looks awesome. Surprised I've never heard of it before.