Instrumenting Erlang code

Michael Truog mjtruog@REDACTED
Mon Jan 27 00:00:52 CET 2020


On 1/26/20 10:41 AM, Vans S wrote:
> On this topic, is there a way to attach instrumentation on the fly in 
> a running system? That can give you a callback onentry and onexit? To 
> profile wall time and perhap do conditional matching / stack trace 
> inspection. To see which calls trigger the slow path for example.

You could take a look at eprof to see how it works ( 
https://github.com/erlang/otp/blob/c15eb5fdf721afed280afdbe0fff37706eef979c/lib/tools/src/eprof.erl#L373 
).  The eprof approach relies on tracing, which is mutating global 
state, so it lacks referential transparency and seems best to avoid in 
production source code (not saying tracing shouldn't be used in production).

Best Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200126/9b977cd3/attachment.htm>


More information about the erlang-questions mailing list