Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang Processes Reduction count

I am trying to find out more about the work distribution between the processes of my Erlang application. The number of reductions executed by a process is, among others, one of the things I am interested.

So I am looking for a means of reading the number of reductions of a process when it exits. While it is be quite straightforward to get this kind of info while the processes is still executing, getting them just before (or rightly after) they exit is another story. I have looked all over the documentation, specially dbg:* functions, unfortunately, to no avail. Mostly because whenever I am notified about the exit of a process it is already too late to do anything about it.

Changing the code of the entire application to read these values before the processes exit is unfeasible. Is there some way to do it other than diving into the VM code and instrumenting it?

Thanks

like image 402
Francesquini Avatar asked Apr 05 '12 12:04

Francesquini


Video Answer


1 Answers

I don't think you can get reductions for processes, but you could get a time-based work distribution by doing a erlang:trace/3 with running and timestamp options. That would get you what you want I think. Naturally you have to collect the data and do some post-processing or perhaps just-in-time processing.

I would also use the option procs to the trace to get the necessary meta-information, i.e. started, terminated etc.

like image 52
psyeugenic Avatar answered Nov 15 '22 19:11

psyeugenic