[lttng-dev] Question: multiple cft_integer for one argument?

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Jul 10 09:32:52 EDT 2012


* changz (zheng.chang at emc.com) wrote:
> Hi,
>
> I found an interesting thing when I went thru lttng-ust samples:
>
> In lttng-ust/tests/hello/ust_tests_hello.h, here is definition of an event:
>
>  28  TRACEPOINT_EVENT(ust_tests_hello, tptest,
>  29     TP_ARGS(int, anint, int, netint, long *, values,
>  30         char *, text, size_t, textlen,
>  31         double, doublearg, float, floatarg,
>  32         bool, boolarg),
>  33     TP_FIELDS(
>  34         ctf_integer(int, intfield, anint)

Here, "anint" (which is a C integer of type "int"), gets written into a
integer field into the event (type "int" too).

>  35         ctf_integer_hex(int, intfield2, anint)

This line writes "anint" into the integer (type int) field, just like
line 34. However, in the trace metadata, it will put a description
attribute that requires that this integer must be pretty-printed as
hexadecimal.

>  36         ctf_integer(long, longfield, anint)

Here, "anint" (again) gets cast into "long" type (either 32 or 64-bit
depending on the architecture), and the result gets written into the
trace. In this specific example, it serves no purpose, it' just there to
show what can be done with TRACEPOINT_EVENTs.

Best regards,

Mathieu

>  37         ctf_integer_network(int, netintfield, netint)
>  38         ctf_integer_network_hex(int, netintfieldhex, netint)
>  39         ctf_array(long, arrfield1, values, 3)
>  40         ctf_array_text(char, arrfield2, text, 10)
>  41         ctf_sequence(char, seqfield1, text,
>  42                  size_t, textlen)
>  43         ctf_sequence_text(char, seqfield2, text,
>  44                  size_t, textlen)
>  45         ctf_string(stringfield, text)
>  46         ctf_float(float, floatfield, floatarg)
>  47         ctf_float(double, doublefield, doublearg)
>  48         ctf_integer(bool, boolfield, boolarg)
>  49     )
>  50 )
>
> Please notice line 34-36. With my understanding, it decides the output  
> format of each argument.
> Why does the argument anint  need three cft_integer with different types?
>
> Best Regards
> Zheng
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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



More information about the lttng-dev mailing list