[ltt-dev] [RFC] New UST 2.0 Tracepoint Event API

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Jul 27 15:06:01 EDT 2011


Hi all,

I'd like to get feedback on the new UST 2.0 tracepoint event API.
The code still needs to be debugged (it does not compile yet), but the
basic structure of the API is in place, and I'd like to get feedback on
this.

In short, an example:

TRACEPOINT_EVENT(< [com_company_]project_[component_]_event >,
    TP_PROTO(int arg0, void *arg1, char *string, size_t strlen,
             long *arg4, size_t arg4_len),
    TP_ARGS(arg0, arg1, string, strlen, arg4, arg4_len),
    TP_FIELDS(

        /* Integer, printed in base 10 */
        ctf_integer(int, field_a, arg0)

        /* Integer, printed with 0x base 16 */
        ctf_integer_hex(unsigned long, field_d, arg1)

        /* Array/Sequence, printed as UTF8-encoded array of bytes */
        ctf_array_text(char, field_b, string, FIXED_LEN)
        ctf_sequence_text(char, field_c, string, size_t, strlen)

        /* String, printed as UTF8-encoded string */
        ctf_string(field_e, string)

        /* Array/sequence of signed integer values */
        ctf_array(long, field_f, arg4, FIXED_LEN4)
        ctf_sequence(long, field_g, arg4, size_t, arg4_len)
    )
)

Note: the print formatting information is actually metadata exported for
the trace viewer. It does not add information to each event in the
trace.

The tracepoint.h header contains a lengthy comment describing the
TRACEPOINT_EVENT() API, along with a usage example:

http://git.lttng.org/?p=ust.git;a=blob;f=include/ust/tracepoint.h

The macros describing the types available within the TP_FIELDS macro are
described at the beginning of:

http://git.lttng.org/?p=ust.git;a=blob;f=include/ust/lttng-tracepoint-event.h

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