<div dir="ltr">Hi Simon,<div><br></div><div>Thank you for reply!<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 7:36 PM, Simon Marchi <span dir="ltr"><<a href="mailto:simon.marchi@polymtl.ca" target="_blank">simon.marchi@polymtl.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I am pretty sure that Dmitri is talking about a check that you can use<br>

in your application, to see if a specific tracepoint is enabled. If<br>
some data that you pass to the tracepoint is expensive to compute, yo<br>
might want to avoid computing it when tracing is disabled.<br></blockquote><div><br></div><div>Yes, exactly.</div><div>Here is nice explanation from dtrace author -- <a href="http://dtrace.org/blogs/ahl/2006/05/08/user-land-tracing-gets-better-and-better/">http://dtrace.org/blogs/ahl/2006/05/08/user-land-tracing-gets-better-and-better/</a> (see Is-Enabled probes)</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> #define tracepoint_enabled(provider, name) caa_unlikely(__tracepoint_##provider##___##name.state)<br>

<br>
Dmitri, that macro that you posted, does it work for you?<br></blockquote><div><br></div><div>Yes, looks working AFAIKT.</div><div>I.e. if (tracepoint_enabled()) { printf(); } gives correct enabled/disabled state.</div><div>
 </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Otherwise, you can simply embed the code in the call to tracepoint:<br>
</blockquote><div><br></div><div>Thanks for suggestions!</div><div>Moving argument evaluation to function is a bit tedious.</div><div>Statement expressions looks nicer, but their portability is questionable (although clang that we use seems to support them).</div>
<div><br></div><div>So from my point of view having tracepoint_enabled() macro is the best possible solution.</div><div><br></div><div>Thanks!</div></div></div></div></div>