Skip to contentSkip to conversation

Question: multiple cft_integer for one argument?

DISCUSSION changz 2 participants 2 messages Jul 10, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

changz

author
#1 lore raw
Quoted 27 lines · changz

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)
 35         ctf_integer_hex(int, intfield2, anint)
 36         ctf_integer(long, longfield, anint)
 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)
Quoted 6 lines

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?

Got it. That means I can define the output format freely.

Thanks

Quoted 8 lines

Best Regards
Zheng

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · * changz ([email protected]) 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:

Quoted 7 lines

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).

Quoted 1 line

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.

Quoted 1 line

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

Quoted 26 lines
 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
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com