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

Philippe Proulx eeppeliteloop at gmail.com
Fri Oct 17 22:36:34 EDT 2014


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