[lttng-dev] Writing .tp files for lttng-gen-tp

Boisvert, Sebastien boisvert at anl.gov
Sat Oct 18 17:16:54 EDT 2014


Hi,

Since all my thorium_message:* tracepoints have the same arguments and same fields,
should I instead use one single tracepoint with an additional argument and field for
the calling context ("actor_receive", "node_receive", and so on):


TRACEPOINT_EVENT(
    thorium,
    message_delivery_path,
    TP_ARGS(
        char *, context,
        struct thorium_message *, message
    ),
    TP_FIELDS(
        ctf_string(context, context)
        ctf_integer(int, message_number, message->number)
        ctf_integer(int, message_action, message->action)
        ctf_integer(int, message_count, message->count)
        ctf_integer(int, message_source_actor, message->source_actor)
        ctf_integer(int, message_destination_actor, message->destination_actor)
        ctf_integer(int, message_source_node, message->source_node)
        ctf_integer(int, message_destination_node, message->destination_node)
    )
)  


I feel like this is better, but I don't know if this a good practice to do this with LTTng.

> ________________________________________
> From: Philippe Proulx [eeppeliteloop at gmail.com]
> Sent: Saturday, October 18, 2014 12:58 PM
> To: Boisvert, Sebastien
> Cc: lttng-dev at lists.lttng.org
> Subject: Re: [lttng-dev] Writing .tp files for lttng-gen-tp
> On Sat, Oct 18, 2014 at 10:39 AM, Boisvert, Sebastien <boisvert at anl.gov> wrote:
> >
> > Hi,
> >
> > I changed the provider name to thorium_message.
> >
> > I also tried using a macro in the template file, but the define alone
> > breaks things.
> >
> > Template file: https://github.com/sebhtml/biosal/blob/master/engine/thorium/tracepoints/lttng/message.tp (the macro is commented)
> >
> >
> > Uncommenting the macro produces these warnings:
> >
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> > Warning: different domain provided (int,thorium_message)
> >
> > And the linker fails.
> Yes, sorry about that, I didn't look at the output.
> lttng-gen-tp has some bugs. It parses everything using regexes, so I guess it
> won't deal properly with custom C preprocessor stuff reusing
> TRACEPOINT_EVENT() within a macro. For some reason, it detects `int` as
> the tracepoint provider name ("domain" in lttng-gen-tp's jargon).
> IMO your use case might already be too advanced for lttng-gen-tp, so I would
> advise that you have a look at defining plain tracepoint providers without
> using lttng-gen-tp: <http://lttng.org/docs/#doc-tracepoint-provider>. It
> basically involves writing a proper template header. The hardest part
> is defining
> the tracepoints using TRACEPOINT_EVENT(), but you already did that.
> So start with this (TP provider name fixed):
> * message.h: <http://pastebin.com/yiqN0CEj>
> * message.c: <http://pastebin.com/BmXiSCbd>
> Build it like this:
> gcc -I../../../.. -I. -c message.c
> and link the resulting message.o with your application as usual.
> >
> > > ________________________________________
> > > From: Philippe Proulx [eeppeliteloop at gmail.com]
> > > Sent: Friday, October 17, 2014 9:36 PM
> > > To: Boisvert, Sebastien
> > > Cc: lttng-dev at lists.lttng.org
> > > Subject: Re: [lttng-dev] Writing .tp files for lttng-gen-tp
> > > On Fri, Oct 17, 2014 at 5:39 PM, Boisvert, Sebastien <boisvert at anl.gov> wrote:
> > > > Hi,
> > > >
> > > > I wrote a big .tp file to define numerous tracepoints that only differ in the event name.
> > > > They all take the same arguments and they all dump the same fields.
> > > >
> > > >
> > > > .tp file: https://github.com/sebhtml/biosal/blob/master/engine/thorium/tracepoints/lttng/message.tp
> > > >
> > > >
> > > > Is there a more compact way of doing that ?
> > > Yes; note that a template file is just part of an eventual C header
> > > file, so C preprocessor
> > > stuff is accepted. This should work:
> > > #include <engine/thorium/message.h>
> > > #define THORIUM_MSG_TP(name) \
> > > TRACEPOINT_EVENT( \
> > > message, \
> > > name, \
> > > TP_ARGS( \
> > > struct thorium_message *, msg \
> > > ), \
> > > TP_FIELDS( \
> > > ctf_integer(int, message_number, msg->number) \
> > > ctf_integer(int, message_action, msg->action) \
> > > ctf_integer(int, message_count, msg->count) \
> > > ctf_integer(int, message_source_actor, msg->source_actor) \
> > > ctf_integer(int, message_destination_actor,
> > > msg->destination_actor) \
> > > ctf_integer(int, message_source_node, msg->source_node) \
> > > ctf_integer(int, message_destination_node,
> > > msg->destination_node) \
> > > ) \
> > > )
> > > THORIUM_MSG_TP(actor_send)
> > > THORIUM_MSG_TP(node_send)
> > > THORIUM_MSG_TP(worker_send)
> > > THORIUM_MSG_TP(worker_receive)
> > > THORIUM_MSG_TP(worker_send_mailbox)
> > > THORIUM_MSG_TP(worker_send_schedule)
> > > THORIUM_MSG_TP(worker_pool_enqueue)
> > > THORIUM_MSG_TP(worker_pool_dequeue)
> > > THORIUM_MSG_TP(worker_enqueue_message)
> > > THORIUM_MSG_TP(actor_receive)
> > > THORIUM_MSG_TP(worker_dequeue_message)
> > > THORIUM_MSG_TP(node_send_system)
> > > THORIUM_MSG_TP(node_receive)
> > > THORIUM_MSG_TP(node_receive_message)
> > > THORIUM_MSG_TP(node_send_dispatch)
> > > THORIUM_MSG_TP(node_dispatch_message)
> > > THORIUM_MSG_TP(transport_send)
> > > THORIUM_MSG_TP(transport_receive)
> > > Please write back if it does not.
> > > BTW, I would suggest that your tracepoint provider name (currently `message`) be
> > > more specific as to what your application really is, e.g., `thorium_msg`.
> > > Phil
> > > >
> > > >
> > > >                 Sébastien
> > > >
> > > >
> > > > _______________________________________________
> > > > lttng-dev mailing list
> > > > lttng-dev at lists.lttng.org
> > > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev



More information about the lttng-dev mailing list