Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: gbastien+lttng@versatic.net (Geneviève Bastien)
Subject: [lttng-dev] [RFC Patch Ust 4/5] Update the ctf-global-type example to show the usage of a global structure
Date: Wed, 26 Mar 2014 10:47:11 -0400	[thread overview]
Message-ID: <1395845232-17669-5-git-send-email-gbastien+lttng@versatic.net> (raw)
In-Reply-To: <1395845232-17669-1-git-send-email-gbastien+lttng@versatic.net>

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




  parent reply	other threads:[~2014-03-26 14:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 14:47 [lttng-dev] LTTng-UST: Add support of CTF structure global type Geneviève Bastien
2014-03-26 14:47 ` [lttng-dev] [RFC Patch Ust 1/5] Update data structures to support CTF global structures Geneviève Bastien
2014-03-26 14:47 ` [lttng-dev] [RFC Patch Ust 2/5] Serialize the CTF global structures for ust-comm Geneviève Bastien
2014-03-26 14:47 ` [lttng-dev] [RFC Patch Ust 3/5] Add the macros to generate the data structures for CTF global structures Geneviève Bastien
2014-03-26 14:47 ` Geneviève Bastien [this message]
2014-03-26 14:47 ` [lttng-dev] [RFC Patch Ust 5/5] Update the LTTng documentation with " Geneviève Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395845232-17669-5-git-send-email-gbastien+lttng@versatic.net \
    --to=gbastien+lttng@versatic.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox