[lttng-dev] Enumerated types in lttng-ust traces?

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Jun 21 00:00:07 EDT 2012


* John Steele Scott (toojays at toojays.net) wrote:
> It seems that the CTF supports enumerations, and babeltrace has
> support for pretty-printing them. But how do you get lttng-ust to emit
> them? Is this possible?
> 
> Right now I'm just using ctf_integer, but it seems like there should
> be way to show human-readable enumeration names in the trace.

Hi John,

You are right, CTF supports enumerations. Currently, neither
lttng-modules nor lttng-ust allow emitting those enumerations from
tracepoints (it's just not been implemented yet).

We'd have to add that to LTTng-UST tracepoints, e.g., something
resembling to:

TRACEPOINT_ENUM(enum_name,
        TP_ENUM_V(SOMENAMEA)            /* value 0 */
        TP_ENUM_V(SOMENAMEB)            /* value 1 */
        TP_ENUM_V(SOMENAMEC, 5)         /* value 5 */
        TP_ENUM_V(SOMENAMED)            /* value 6 */
        TP_ENUM_R(SOMENAMEE, 8, 10)     /* range 8 to 10 (inclusive) */
        TP_ENUM_V(SOMENAMEF)            /* value 11 */
)

then:

TRACEPOINT_EVENT(prog_module, event,
        TP_ARGS(int, someint),
        TP_FIELDS(
                ctf_enum(enum_name, int, fieldname, someint)
        )
)

where ctf_enum would be:

ctf_enum(name of enumeration,
        type of enumeration container,
        name of the field,
        name of the TP_ARGS entry to use as source
)

I did early experiments with this in lttng-modules (code unfinished and
unused at this stage). You can dig it up in the files:

probes/lttng-type-list.h
probes/lttng-types.h

of lttng-modules. Please keep in mind that these are unfinished and
might need a lot of changes to get straight.

Thoughts ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list