Instrumenting Erlang code

Frank Muller frank.muller.erl@REDACTED
Sun Jan 26 13:58:04 CET 2020


Hi everyone

I would like to implement a custom instrumentation module for my Erlang
code.
Let assume this function:

f1() ->
   … code here …
   ok.

When instrumenting this function, I would like it to look like:

f1() ->
   instrument:start(),

   … code here …

   instrument:end(), <— just before retuning from f1
   ok.

Other problem I can think of is when we have multiple return paths and/or
recursive loop:

f2() ->
  instrument:start(),

  receive ->
    {msg1, M1} -> instrument:end(), M1;
    {msg2, M2} -> instrument:end(), M2;
    _ -> instrument:end(), f2()
  end.

Is that doable?
If yes, can I apply like this logic to all modules running in my Erlang
node?

@Kostis: does Concuerror (https://github.com/parapluu/Concuerror) use this
technique?

Thanks for you help.
/Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200126/919dd1a9/attachment.htm>


More information about the erlang-questions mailing list