[lttng-dev] sdt.h tracepoints with unicode data and/or structs

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Sep 12 15:03:04 UTC 2016


----- On Sep 6, 2016, at 3:00 PM, Milian Wolff milian.wolff at kdab.com wrote:

> Hey all,
> 
> where can I find more documentation on how to use sdt.h to add static
> tracepoints to user-land applications? If this is not the right place to ask,
> please refer to to elsewhere.

Hi Milian,

LTTng-UST offers a "tracepoint" instrumentation facility, which can optionally
emit "sdt.h" probe points too for compatibility with SystemTAP.

> 
> I plan to upstream a collection of tracepoints to Qt, and possibly elsewhere.
> One problem I'm having right now is figuring out how to "design" the
> tracepoints such that they have minimal overhead.

The main question here would be: do you want your instrumentation to be
usable with LTTng-UST ? If yes, then you want the tracepoint instrumentation
facility. Else, if you only plan on using SystemTAP, you can use sdt.h
instrumentation.

> 
> So my questions:

My answers will be about lttng-ust tracepoints.

> 
> What data types can I use for trace point arguments?

See http://lttng.org/docs/#doc-c-application

> 
> Can I pass UTF16 strings? Do they need to be null-terminated?

You should convert them to UTF8.

A ctf_string() needs to be null-terminated. A ctf_sequence_text() is
not required to be null-terminated. See http://lttng.org/docs/#doc-liblttng-ust-tp-fields

> 
> Can I pass structs? Or do I need to pass each member as an individual
> argument?

You can pass pointers to structures to the tracepoint() call from your
application source code, and then you need to express each individual
field you want to serialize into the trace within the TP_FIELDS() macro.
Ref. http://lttng.org/docs/#doc-liblttng-ust-tp-fields

Thanks,

Mathieu


> 
> Thanks
> 
> --
> Milian Wolff | milian.wolff at kdab.com | Software Engineer
> KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
> Tel: +49-30-521325470
> KDAB - The Qt Experts
> _______________________________________________
> 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


More information about the lttng-dev mailing list