When a Erlang system hangs I want to know what the system is doing during that time. For a c/c++ program, I can easily run the pstack, but I didn't find out a handy tool for this purpose in Erlang.
- What is the pstack equivalent in Erlang?
- Actually I want to check the running stack trace of the following process.
"/opt/couchbase/lib/erlang/erts-5.10.4.0.0.1/bin/beam.smp -P 327680 -K true -- -root /opt/couchbase/lib/erlang -progname erl --... "
and I started a new Erlang shell and start the webtool and check the appmon however I can't find the above application. What may cause this?
Thanks
1条答案
按热度按时间0yycz8jy1#
Concerning
pstack
equivalent, have you read Erlang Profiling from official guide? It gives you lot of example on how to profile your application and find where your code stuck.Another useful tools is
observer
it will show all working process, CPU usage, process stack and lot of more information.If you don't see anything with these tools, you can try with Erlang debugger .
Now concerning couchbase, if your application is currently running, you can connect to it with Erlang shell and launch previous quoted commands and applications.
I don't know if you are using couchbase alone or with couchdb, but, if you want to use
observer
or other tools from command line, you can startcouchdb
with-i
flag:In case of your application run remotely without GUI, you can use
etop
, its a CLI alternative toobserver
. You can also dumpetop
output to file if you don't want to run it directly from your Erlang shell. IHMO, if you want more information concerning I/O or debug, useeprof
,fprof
and other profiling tools with dump file (see alsoeep
profiling tool, easy to use).Another alternative, if you are using SSH and want to see
observer
window, you can use X11Forwarding with ssh:ssh -X $yourserver
orssh -Y $yourserver
and simply runobserver:start().
in your Erlang shell.