[lttng-dev] Writing .tp files for lttng-gen-tp
Thibault, Daniel
Daniel.Thibault at drdc-rddc.gc.ca
Mon Oct 20 09:29:17 EDT 2014
----------------------------------------------------------------------
Date: Fri, 17 Oct 2014 21:39:21 +0000
From: "Boisvert, Sebastien" <boisvert at anl.gov>
> 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 ?
>
> Sébastien
----------------------------------------------------------------------
In the kernel domain, one can declare a "tracepoint class" with DECLARE_EVENT_CLASS, and then use DEFINE_EVENT to instantiate the abstract event class into individual trace events that share a single signature. Surely the same can be done in user-space?
Looking at /usr/src/lttng-ust/include/lttng/tracepoint.h, we see there are TRACEPOINT_EVENT_CLASS and TRACEPOINT_EVENT_INSTANCE macros right beside TRACEPOINT_EVENT, so I suspect you could replace your message.tp with something like:
[...]
TRACEPOINT_EVENT_CLASS(
thorium_message,
thorium_event_template,
TP_ARGS(
struct thorium_message *, message
),
TP_FIELDS(
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)
)
)
TRACEPOINT_EVENT_INSTANCE(
thorium_message,
thorium_event_template,
actor_send,
TP_ARGS(
struct thorium_message *, message
)
)
TRACEPOINT_EVENT_INSTANCE(
thorium_message,
thorium_event_template,
node_send,
TP_ARGS(
struct thorium_message *, message
)
)
[...]
Try it and let us know. This should be added to the lttng-gen-tp man pages if it works.
Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
RDDC - Centre de recherches de Valcartier | DRDC - Valcartier Research Centre
2459 route de la Bravoure
Québec QC G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>
More information about the lttng-dev
mailing list