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
I don’t think you can get
reductionsfor processes, but you could get a time-based work distribution by doing aerlang:trace/3withrunningandtimestampoptions. 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
procsto the trace to get the necessary meta-information, i.e. started, terminated etc.