[erlang-questions] erl_tracer, trace_status and pids

Loïc Hoguin essen@REDACTED
Tue May 30 11:40:31 CEST 2017


On 05/30/2017 10:14 AM, Loïc Hoguin wrote:
>>     * trace_status is always called before any other enabled_*/3 so I
>>     should be fine just doing nothing in enabled_*/3, right? I'm only
>>     checking that the tracer processes are still alive anyway.
>>
>>
>> no, trace_status is not always called before enabled_*. The only event 
>> that I know of where it is called is enabled_call/3, there may be a 
>> couple of more but not all of them.
> 
> Alright. I'm a bit confused still. Would it make sense to only perform 
> some checks for trace_status, for example checking that the tracer 
> process exists? Then for other enabled_*/3 calls I would just reject 
> events I don't need.
> 
>>     Basically if you could shed light on the circumstances around
>>     trace_status that would help a lot for optimizing this. :-)
>>
>>
>> the check for trace_status call is made in various places in the vm 
>> code where the VM finds it convenient to do a check and see if the 
>> tracer is still alive. There are no specific rules about when it is 
>> called.
> 
> It sounds like the answer to my question is a yes. :-)

Answering myself.

I think what I was looking for can be found in this sentence of the 
documentation:

"It is called in multiple scenarios, but most significantly it is used 
when tracing is started using this tracer."

If correct, then this means trace_status is always called at least once 
before anything happens; and that's good enough for me. That would allow 
me to remove traces for the tracer processes immediately when receiving 
the trace_status, and not have to worry about that in enabled_*/3 calls.

Cheers,

-- 
Loïc Hoguin
https://ninenines.eu



More information about the erlang-questions mailing list