<div dir="ltr">Would appreciate any input/suggestion on this. Thanks a lot.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Regards,<br>Sudhagar<br><br>Visit my blog at: <a href="http://sudhagarc.blogspot.com">http://sudhagarc.blogspot.com</a></div></div>
<br><div class="gmail_quote">On Tue, Dec 23, 2014 at 3:16 AM, Sudhagar Chinnaswamy <span dir="ltr"><<a href="mailto:sudhagar@gmail.com" target="_blank">sudhagar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi:</div><div><br></div><div>I have the same need as discussed in the below mentioned thread. I want to use LTTng, but most of the cases we need to log different parameters under the same provider and event. </div><div><br></div><a href="http://lists.lttng.org/pipermail/lttng-dev/2013-December/022134.html" target="_blank">http://lists.lttng.org/pipermail/lttng-dev/2013-December/022134.html</a><div><br></div><div>When I tried a simple program to log the variable arguments under same provider/event as suggested in the above thread using the macro below, I found that the function "my_snprintf" is called "twice" when the logging for the event is enabled for each tracepoint call. It seems inefficient to call the same function twice. Is there something that could be done to make it efficient or am I missing something?</div><div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:medium"><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span style="font-size:10.5pt;font-family:Helvetica,sans-serif">— 8< —</span></p></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:medium"><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New';white-space:pre-wrap">#define tracepoint_for_format_string(provider, name, …) \</pre><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New'"> do { \</pre><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New'"> char msg_buf[MAX_BUFFER_SIZE]; \</pre><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New'"> tracepoint(provider, name, my_snprintf(msg_buf, MAX_BUFFER_SIZE, __VA_ARGS__)); \</pre><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:'Courier New'"> } while (0)</pre><div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span style="font-size:10.5pt;font-family:Helvetica,sans-serif">— 8< —</span></p></div></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:medium"></div></div><div><br></div><div>Alternatively, is there any other approach to achieve my requirement: Need to use same provider & event name to log variable arguments?</div><div><br></div><div>For e.g.,</div><div><div>my_tracepoint(hello_world, test, "argc=%d, argv=%p", argc, argv);</div><div>my_tracepoint(hello_world, test, "argv[%u] :: %s", x, argv[x]);</div><div>my_tracepoint(hello_world, test, "Quitting now!");</div></div><div><br></div><div>Thanks in advance.</div><div><br clear="all"><div><div>Regards,<br>Sudhagar<br><br></div></div>
</div></div>
</blockquote></div><br></div>