How can I profile a linked-in port driver? OTP tools (fprof, etc.) apparently only profile Erlang code, and I don't have a C executable file to feed to gprof.
Can't you just profile the erl executable and then get that to the gprof tool? I am pretty sure this is how it is done by the Erlang devs anyway.
as far as linked-in port driver is .so library that is dynamically loaded into erl process (on linux) you can run valgrind --tool=callgrind --callgrind-out-file=file.out erl (see other options in docs for callgrind), then execute some tests from erl shell, exit from shell and load file.out in some tool like KCachegrind
Related
Is it possible to replace the erl shell with a system command? Similar to how you would with a POSIX exec call?
I'm trying to set up an SSH server in Erlang that gives a separate CLI instead of the built in one. I'm aware of OpenSSH's sshd's options to do this; does Erlang have something similar?
For example, how would I get the following command to work as it does with sshd(8) in an Erlang environment?
# connect to Erlang SSH server and drop into IPython shell
ssh user#host ipython
I have the server working fine—I'm able to connect without problems—and I know that you can develop your own CLI with the ssh_cli option for ssh:daemon. It might have something to do with ports and drivers or the user_drv:start command, but I'm having difficulty figuring out how this all works.
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
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 start couchdb with -i flag:
# -i use the interactive Erlang shell
couchdb -i
In case of your application run remotely without GUI, you can use etop, its a CLI alternative to observer. You can also dump etop 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, use eprof, fprof and other profiling tools with dump file (see also eep 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 or ssh -Y $yourserver and simply run observer:start(). in your Erlang shell.
I have Erlang and Elixir installed on my thumb drive. The launcher for Elixir is a Windows Batch file rather than a standalone executable.
One of the computers that I use regularly for school blocks the command prompt, but Erlang runs without command prompt, so I am able to use Erlang on the school computer.
I was wondering if I could run Elixir manually or potentially with PowerShell, so that I could code at school.
If you look at the bottom of the batch file you'll see that elixir.bat is just building up an argument string to use when invoking the Erlang executable. You can just build the argument string by hand, and if you launch Erlang correctly you'll be in Elixir-land.
Alternatively, if you can run any executable, maybe you should try putting a copy of PowerShell on your thumb drive.
I'm working on using erlang development server. Is there a way fro me to start the erlang vm and continue from the commandline or add a script to the startup files? To be clear I want to start erlang and keep it running outside of the command prompt.
You can use the -detached flag. See http://www.erlang.org/doc/man/erl.html for more information.
I usually use scripts, which rebar create-node do provide. There is such commands as: start, stop, ping and attach. Although you must use erlang releases in order to use this scripts (at list take a look at template, maybe it would be helpful)
I want to play with Riak http://riak.basho.com/ or a least get it running on a Windows system. I have downloaded the source code and compiled it but that's where I get stuck, how do I start it?
It does run, altough I havent managed to run it as a service yet.
Install CYGwin, install latest erlang, get source code, compile in cygwin
then the fun part, adjust according to your paths and place into a batch
c:\riak\rel\riak\erts-5.7.4\bin\erl -boot c:\riak\rel\riak\releases\0.8\riak -embedded -config c:\riak\rel\riak\etc\app.config -args_file c:\riak\rel\riak\etc\vm.args -- console
Regards
Looks like the riak source has several bash start scripts. You would have to convert those to a windows batch script equivalent. That could be a fairly interesting chore given how limited batch scripts are. Those start-*.sh files show how to start it up though so I'd start there.
The http://hg.basho.com/riak/src/tip/README Readme file has futher info on what each script does.
Riak can not be run on Windows, only on Linux and Mac.
An alternative is to run VMWare or VirtualBox and run Riak inside a Linux VM. Works great for me.
Running it inside docker instance works very well - this is in 2017 the only way to successfully run Riak on Windows. You could probably get something running using Cygwin but this will be very complex and unreliable. Running under Docker is currently the most idiomatic solution.