All of lore.kernel.org
 help / color / mirror / Atom feed
* Question: multiple cft_integer for one argument?
@ 2012-07-10  8:06 changz
  0 siblings, 0 replies; 3+ messages in thread
From: changz @ 2012-07-10  8:06 UTC (permalink / raw)
  To: lttng-dev

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question: multiple cft_integer for one argument?
       [not found] <4FFBE298.2070205@emc.com>
  2012-07-10  8:44 ` changz
@ 2012-07-10 13:32 ` Mathieu Desnoyers
  1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2012-07-10 13:32 UTC (permalink / raw)
  To: changz; +Cc: lttng-dev

* changz (zheng.chang@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@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question: multiple cft_integer for one argument?
       [not found] <4FFBE298.2070205@emc.com>
@ 2012-07-10  8:44 ` changz
  2012-07-10 13:32 ` Mathieu Desnoyers
  1 sibling, 0 replies; 3+ messages in thread
From: changz @ 2012-07-10  8:44 UTC (permalink / raw)
  To: lttng-dev

On 7/10/2012 16:06 PM, changz 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)
>  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)
>  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

> Best Regards
> Zheng
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-10 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10  8:06 Question: multiple cft_integer for one argument? changz
     [not found] <4FFBE298.2070205@emc.com>
2012-07-10  8:44 ` changz
2012-07-10 13:32 ` Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.