[lttng-dev] Correct way to use the tpl file

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Fri Nov 30 13:49:04 EST 2018


----- On Nov 30, 2018, at 12:30 PM, John OSullivan <John.OSullivan at BlackBox.com> wrote: 

> Hi Mathieu,

> Thank you for the reply and my apologies for the confusion. Let me try and
> clarify.

> I understood that the use of the class and instance concepts in the tpl file was
> to be able to declare a class with as you say a number of fields and then
> create instances of that class that provided a way of defining specific
> variants of that class.

> For example

> TRACEPOINT_EVENT_CLASS(
> /* Tracepoint provider name */
> core_event_trace,

> /* Tracepoint class name */
> core_event_tracepoint_class,

> /* Input arguments */
> TP_ARGS(
> int, event_type

> int, second_field
> int, third_field

> int, fourth_field
> ),

> /* Output event fields */
> TP_FIELDS(
> ctf_integer(int, event_type, event_type)
> ctf_integer(int, second_field, second_field)

> ctf_integer(int, third_field, third_field)
> )
> )

> Then we declare an instance

> TRACEPOINT_EVENT_INSTANCE(
> core_event_trace,
> core_event_tracepoint_class,
> first_event_tracepoint,
> TP_ARGS(
> int, event_type

> Int, first_field

> )
> )

> And a second one

> TRACEPOINT_EVENT_INSTANCE(
> core_event_trace,
> core_event_tracepoint_class,
> second_event_tracepoint,
> TP_ARGS(
> int, event_type

> Int, second_field

> )
> )

> So the two instances do not define all of the fields in the class definition,
> the first only defines first_field and the second only defines second_field,
> will this work or do the field in the instance always have to match the fields
> in the class?

I see from the examples above that when you say "field" in your question here, you actually mean "arguments to TP_ARGS". 

So the answer is that the arguments need to match exactly between the instances and the class they refer to. 

Thanks, 

Mathieu 

> From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com]
> Sent: 30 November 2018 17:13
> To: John O'Sullivan
> Cc: lttng-dev
> Subject: [EXTERNAL] Re: [lttng-dev] Correct way to use the tpl file

> ----- On Nov 30, 2018, at 11:09 AM, John OSullivan <John.OSullivan at BlackBox.com>
> wrote:

>> Hi,

>> I am looking for some advice on the best way to manage the tracing of some user
>> space events.

>> I have a series of events that are fed to queues, they look something like the
>> following sample

>> EventEnd* event_end_new()
>> {
>> EventEnd* event_end = bb_xnew(EventEnd,__func__);

>> if (event_end != NULL)
>> {
>> event_end->type = EQ_EVENT_END;
>> . .. other event specific fields here

>> ..
>> }
>> #ifdef LTTNG_TRACE
>> tracepoint(core_event_trace, end_event_tracepoint, EQ_EVENT_END);
>> #endif
>> return event_end;
>> }

>> I want to try and trace these so created the following template shown below. My
>> question is, does the class have to have all of the possible members that the
>> different instances will have, as each unique event is likely to have different
>> members will the class have to have all of these members defines, and if this
>> is the case is it okay for an instance to just implement a subset of the
>> members the class defines?
> I am a bit confused by your use of the word "members" here. A tracepoint class
> has a provider name,

> a class name, input argument, and output fields.

> The event instance refers to the class by provider and class name, defines its
> own name, and needs to

> have a compatible input argument prototype (same number of arguments, same
> types). It will serialize

> the output fields in the exact layout described by the event class.

> I know it does not directly answer your question, but I'm really unsure about
> what you mean

> by "members".

> Thanks,

> Mathieu

>> TRACEPOINT_EVENT_CLASS(
>> /* Tracepoint provider name */
>> core_event_trace,

>> /* Tracepoint class name */
>> core_event_tracepoint_class,

>> /* Input arguments */
>> TP_ARGS(
>> int, event_type

>> ),

>> /* Output event fields */
>> TP_FIELDS(
>> ctf_integer(int, event_type, event_type)

>> )
>> )

>> TRACEPOINT_EVENT_INSTANCE(
>> core_event_trace,
>> core_event_tracepoint_class,
>> end_event_tracepoint,
>> TP_ARGS(
>> int, event_type

>> )
>> )

>> TRACEPOINT_EVENT_INSTANCE(
>> core_event_trace,
>> core_event_tracepoint_class,
>> start_event_tracepoint,
>> TP_ARGS(
>> int, event_type
>> )
>> )

>> TRACEPOINT_EVENT_INSTANCE(
>> core_event_trace,
>> core_event_tracepoint_class,
>> foo_event_tracepoint,
>> TP_ARGS(
>> int, event_type
>> )
>> )

>> This email and any files transmitted with it are confidential and are intended
>> for the sole use of the individual to whom they are addressed. Black Box
>> Corporation reserves the right to scan all e-mail traffic for restricted
>> content and to monitor all e-mail in general. If you are not the intended
>> recipient or you have received this email in error, any use, dissemination or
>> forwarding of this email is strictly prohibited. If you have received this
>> email in error, please notify the sender by replying to this email.

>> _______________________________________________
>> 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

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


More information about the lttng-dev mailing list