<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">@Kostis: does Concuerror (<a href="https://github.com/parapluu/Concuerror" target="_blank">https://github.com/parapluu/Concuerror</a>) use this technique?</div></blockquote><div><br></div><div>
<div>Concuerror's instrumenter does not really work in the way you need. It is instead doing the following things:</div><div>* 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 not)<br></div><div>* adds a similar inspector function to every receive statement</div><div><br></div><div>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.<br></div><div><br></div><div>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:</div><div><br></div><div>Original:</div><div><br></div><div>f1() -></div><div>  Body1.</div><div><br></div><div>Becomes:</div><div><br></div><div>f1() -></div><div>  instrument:start(),</div><div>  R = f1_orig(),</div><div>  instrument:stop(),</div><div>  R</div><div><br></div><div>fi_orig() -></div><div>  Body1.</div><div><br></div><div>Hope this helps!</div><div>Stavros<br></div><div><br></div></div></div></div>