Hi Simon, Thank you for reply!
On Wed, Jun 25, 2014 at 7:36 PM, Simon Marchi <[email protected]> wrote: > I am pretty sure that Dmitri is talking about a check that you can use > in your application, to see if a specific tracepoint is enabled. If > some data that you pass to the tracepoint is expensive to compute, yo > might want to avoid computing it when tracing is disabled. > Yes, exactly. Here is nice explanation from dtrace author -- http://dtrace.org/blogs/ahl/2006/05/08/user-land-tracing-gets-better-and-better/ (see Is-Enabled probes) > > #define tracepoint_enabled(provider, name) > caa_unlikely(__tracepoint_##provider##___##name.state) > > Dmitri, that macro that you posted, does it work for you? > Yes, looks working AFAIKT. I.e. if (tracepoint_enabled()) { printf(); } gives correct enabled/disabled state. Otherwise, you can simply embed the code in the call to tracepoint: > Thanks for suggestions! Moving argument evaluation to function is a bit tedious. Statement expressions looks nicer, but their portability is questionable (although clang that we use seems to support them). So from my point of view having tracepoint_enabled() macro is the best possible solution. Thanks!
_______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
