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

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Aug 31 12:36:39 EDT 2011


Hi,

I've been informed that support for a per-tracepoint format string would
be welcomed by many. I would prefer not to make formats strings a
requirement, but rather an optional feature. I am considering the
following API:

TRACEPOINT_FORMAT(tracepoint_name,
        "text describing a format string with args like %s and also %d",
        fieldname_1, fieldname_2)

where fieldname_* refer to the name of the fields declared in the
tracepoint (NOT the tracepoint arguments!).

e.g.

TRACEPOINT_EVENT(ust_tests_hello_tptest,
        TP_PROTO(int anint, long along, char *text)
        TP_ARGS(anint, along, text)
        TP_FIELDS(
                ctf_integer(int, intfield, anint)
                ctf_integer(long, longfield, along)
                ctf_string(stringfield, text)
        )
)

TRACEPOINT_FORMAT(tracepoint_name,
        "some message %d and more %s",
        intfield, stringfield)

Having some level of automated compiler-level type checking for the
format string in there might be a nice to have, but might be rather
tricky, and could change the API slightly as I proceed to the
implementation.

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