From mboxrd@z Thu Jan 1 00:00:00 1970 From: gbastien+lttng@versatic.net (=?UTF-8?q?Genevi=C3=A8ve=20Bastien?=) Date: Wed, 26 Mar 2014 10:47:11 -0400 Subject: [lttng-dev] [RFC Patch Ust 4/5] Update the ctf-global-type example to show the usage of a global structure In-Reply-To: <1395845232-17669-1-git-send-email-gbastien+lttng@versatic.net> References: <1395845232-17669-1-git-send-email-gbastien+lttng@versatic.net> Message-ID: <1395845232-17669-5-git-send-email-gbastien+lttng@versatic.net> Signed-off-by: Genevi?ve Bastien --- tests/ctf-global-types/ctf-global-types.c | 8 ++++++-- .../ctf-global-types/ust_tests_ctf_global_types.h | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/ctf-global-types/ctf-global-types.c b/tests/ctf-global-types/ctf-global-types.c index 81b69e1..55c2ad0 100644 --- a/tests/ctf-global-types/ctf-global-types.c +++ b/tests/ctf-global-types/ctf-global-types.c @@ -25,6 +25,7 @@ int main(int argc, char **argv) { int i; int delay = 0; + char text[10] = "test"; if (argc == 2) delay = atoi(argv[1]); @@ -34,8 +35,11 @@ int main(int argc, char **argv) sleep(delay); fprintf(stderr, "Tracing... "); - for (i = 0; i < 100; i++) { - tracepoint(ust_tests_ctf_global_types, tptest, i, (i % 6)); + for (i = 0; i < 20; i++) { + tracepoint(ust_tests_ctf_global_types, tptest, i, (i % 6), text, strlen(text)); + if (i == 10) { + strcpy(text, "abcdefgh"); + } } for (i = 0; i < 10; i++) { diff --git a/tests/ctf-global-types/ust_tests_ctf_global_types.h b/tests/ctf-global-types/ust_tests_ctf_global_types.h index 6fe2058..7b704d2 100644 --- a/tests/ctf-global-types/ust_tests_ctf_global_types.h +++ b/tests/ctf-global-types/ust_tests_ctf_global_types.h @@ -38,16 +38,36 @@ TRACEPOINT_ENUM(ust_tests_ctf_global_types, testenum, ) ) +TRACEPOINT_STRUCT(ust_tests_ctf_global_types, inner, + TP_ARGS(char *, text, size_t, textlen, + int, enumvalue), + TP_FIELDS( + ctf_array(char, arrfield, text, 10) + ctf_sequence(char, seqfield, text, size_t, textlen) + ctf_enum(ust_tests_ctf_global_types, testenum, enumfield, enumvalue) + ) +) + +TRACEPOINT_STRUCT(ust_tests_ctf_global_types, outer, + TP_ARGS(char *, text, size_t, textlen, + int, enumvalue), + TP_FIELDS( + ctf_string(stringfield, text) + ctf_struct(ust_tests_ctf_global_types, inner, structfield, text, textlen, enumvalue) + ) +) + /* * Enumeration field is used twice to make sure the global type declaration * is entered only once in the metadata file. */ TRACEPOINT_EVENT(ust_tests_ctf_global_types, tptest, - TP_ARGS(int, anint, int, enumval), + TP_ARGS(int, anint, int, enumval, char *, text, size_t, textlen), TP_FIELDS( ctf_integer(int, intfield, anint) ctf_enum(ust_tests_ctf_global_types, testenum, enumfield, enumval) ctf_enum(ust_tests_ctf_global_types, testenum, enumfield_bis, enumval) + ctf_struct(ust_tests_ctf_global_types, outer, structfield, text, textlen, enumval) ) ) -- 1.9.1