[lttng-dev] Test if tracepoint is enabled

David Bryant david.bryant at quantum.com
Mon Nov 26 23:09:42 EST 2012


Hi all,

Is it feasible to have an officially supported way of determining if a 
tracepoint is currently enabled?

In my code I would like to test if the tracepoint is enabled, and if it 
isn't, avoid doing expensive setup work.

I've been doing the following:

   if 
(__builtin_expect(!!(__tracepoint_sample_component___message.state), 0)) {
       /* setup work */
       tracepoint(sample_component, message);
       /* cleanup work */
   }

But it's weak for two reasons:

  * The 'state' attribute goes true when the tracepoint is enabled, but
    stays true after the tracepoint is disabled. It only goes false when
    the session is destroyed.
  * It uses a private / unofficial API

What I'd like is an official API that correctly evaluates whether a 
tracepoint is enabled or not?

Is this possible?

Thanks,
Dave

----------------------------------------------------------------------
The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20121127/d1ff13eb/attachment.html>


More information about the lttng-dev mailing list