[lttng-dev] [RFC Patch Ust 4/5] Update the ctf-global-type example to show the usage of a global structure
Geneviève Bastien
gbastien+lttng at versatic.net
Wed Mar 26 10:47:11 EDT 2014
Signed-off-by: Geneviève Bastien <gbastien+lttng at versatic.net>
---
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
More information about the lttng-dev
mailing list