[lttng-dev] TP_ARGS for TRACEPOINT_EVENT_CLASS and TRACEPOINT_EVENT_INSTANCE

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Dec 20 14:28:08 EST 2018


This is due to limitations of the C preprocessor. We need to have the TP_ARGS() available 
both in the TRACEPOINT_EVENT_INSTANCE(), which generates the tracepoint prototype 
used to validate type compability of the tracepoint callsite within the application, and within 
TRACEPOINT_EVENT_CLASS() which is used to generate the probe callback with the 
correct arguments. 

Unfortunately, the C preprocessor does not allow much freedom when it comes to accessing 
arguments of another macro. 

Thanks, 

Mathieu 

----- On Dec 20, 2018, at 12:21 PM, Yonghong Yan <yanyh15 at gmail.com> wrote: 

> Then why bother to require to have the TP_ARGS in TRACEPOINT_EVENT_INSTANCE?

> Yonghong

> On Thu, Dec 20, 2018 at 11:56 AM Philippe Proulx < [
> mailto:eeppeliteloop at gmail.com | eeppeliteloop at gmail.com ] > wrote:

>> On Thu, Dec 20, 2018 at 11:47 AM Yonghong Yan < [ mailto:yanyh15 at gmail.com |
>> yanyh15 at gmail.com ] > wrote:

>>> I am looking at the following example from lttng-ust manual. The same TP_ARGS (
>>> ... ) are repeated in both the TRACEPOINT_EVENT_CLASS and
>>> TRACEPOINT_EVENT_INSTANCE definition. My understanding is that it actually
>>> allows using different arguments, even in this example it is the same. Am I
>> > right?

>> No it does not: they need to match.

>> See < [
>> https://github.com/lttng/lttng-ust/commit/c75c0422c64f33c0102e1778cecc812c58b700e5
>> |
>> https://github.com/lttng/lttng-ust/commit/c75c0422c64f33c0102e1778cecc812c58b700e5
>> ] >.

>> Phil


>>> I also like the feature of having one TP_ARGS in the TRACEPOINT_EVENT_CLASS that
>>> declares the arguments for several TRACEPOINT_EVENT_INSTANCE so we do not need
>> > to have TP_ARGS in TRACEPOINT_EVENT_INSTANCE. Is that possible?

>> > Thank you
>> > Yonghong

>> > TRACEPOINT_EVENT_CLASS(
>> > my_provider,
>> > my_tracepoint_class,
>> > TP_ARGS(
>> > int, my_integer_arg,
>> > struct app_struct *, app_struct_arg
>> > ),
>> > TP_FIELDS(
>> > ctf_integer(int, a, my_integer_arg)
>> > ctf_integer(unsigned long, b, app_struct_arg->b)
>> > ctf_string(c, app_struct_arg->c)
>> > )
>> > )

>> > TRACEPOINT_EVENT_INSTANCE(
>> > my_provider,
>> > my_tracepoint_class,
>> > event_instance1,
>> > TP_ARGS(
>> > int, my_integer_arg,
>> > struct app_struct *, app_struct_arg
>> > )
>> > )

>> > TRACEPOINT_EVENT_INSTANCE(
>> > my_provider,
>> > my_tracepoint_class,
>> > event_instance2,
>> > TP_ARGS(
>> > int, my_integer_arg,
>> > struct app_struct *, app_struct_arg
>> > )
>> > )


>> > _______________________________________________
>> > lttng-dev mailing list
>> > [ mailto:lttng-dev at lists.lttng.org | lttng-dev at lists.lttng.org ]
>>> [ https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev |
>> > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ]

> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers 
EfficiOS Inc. 
http://www.efficios.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20181220/3b0fd3f5/attachment-0001.html>


More information about the lttng-dev mailing list