Instrumenting Erlang code

Stavros Aronis aronisstav@REDACTED
Tue Jan 28 09:59:58 CET 2020

> @Kostis: does Concuerror ( use
> this technique?

Concuerror's instrumenter does not really work in the way you need. It is
instead doing the following things:
* wraps every function call / apply into a call to an inspector function
concuerror_inspect:inspect (this function does a simple runtime check using
the process dictionary to decide whether a process is under Concuerror or
* adds a similar inspector function to every receive statement

The process dictionary trick used to decide which modules should have the
instrumentation on and which not might be useful to you, if you want to
instrument all modules but not affect all processes: if the process has a
specific atom in its dictionary then instrumentation is on, otherwise not.

Without thinking too much about it, if I wanted to implement your variant
I'd write a parse transform or custom instrumenter that would just
introduce a helper function for every function like this:


f1() ->


f1() ->
  R = f1_orig(),

fi_orig() ->

Hope this helps!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list