Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: nils.carlson@ericsson.com (Nils Carlson)
Subject: [ltt-dev] [PATCH 2/2] Add a simple test case for TRACE_EVENT
Date: Wed, 25 Aug 2010 08:14:21 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1008250813480.7660@as68123.uab.ericsson.se> (raw)
In-Reply-To: <4C73E8DB.5020905@polymtl.ca>


On Tue, 24 Aug 2010, David Goulet wrote:

>
>
> On 10-08-24 07:05 AM, Nils Carlson wrote:
>> The test case is useful for verifying compilation of the simplest
>> possible TRACE_EVENT.
>> ---
>>   configure.ac                         |    1 +
>>   tests/Makefile.am                    |    2 +-
>>   tests/trace_event/Makefile.am        |    9 +++++++++
>>   tests/trace_event/run                |    5 +++++
>>   tests/trace_event/trace_event_test.c |   14 ++++++++++++++
>>   tests/trace_event/trace_event_test.h |   34 ++++++++++++++++++++++++++++++++++
>>   6 files changed, 64 insertions(+), 1 deletions(-)
>>   create mode 100644 tests/trace_event/Makefile.am
>>   create mode 100755 tests/trace_event/run
>>   create mode 100644 tests/trace_event/trace_event_test.c
>>   create mode 100644 tests/trace_event/trace_event_test.h
>>
>> diff --git a/configure.ac b/configure.ac
>> index 19ec6a7..dee974f 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -121,6 +121,7 @@ AC_CONFIG_FILES([
>>   	tests/test-libustinstr-malloc/Makefile
>>   	tests/dlopen/Makefile
>>   	tests/same_line_marker/Makefile
>> +	tests/trace_event/Makefile
>>   	libustinstr-malloc/Makefile
>>   	libustfork/Makefile
>>   	libustd/Makefile
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index c1fc928..ab13cd7 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -1,3 +1,3 @@
>> -SUBDIRS = hello hello2 basic basic_long fork simple_include snprintf test-nevents test-libustinstr-malloc dlopen same_line_marker
>> +SUBDIRS = hello hello2 basic basic_long fork simple_include snprintf test-nevents test-libustinstr-malloc dlopen same_line_marker trace_event
>>
>>   dist_noinst_SCRIPTS = test_loop runtests trace_matches
>> diff --git a/tests/trace_event/Makefile.am b/tests/trace_event/Makefile.am
>> new file mode 100644
>> index 0000000..6de9a12
>> --- /dev/null
>> +++ b/tests/trace_event/Makefile.am
>> @@ -0,0 +1,9 @@
>> +AM_CPPFLAGS = -I$(top_srcdir)/include
>> +
>> +noinst_PROGRAMS = trace_event_test
>> +trace_event_test_SOURCES = trace_event_test.c
>> +trace_event_test_LDADD = $(top_builddir)/libust/libust.la $(top_builddir)/libust-initializer.o
>> +
>> +CFLAGS_trace_event_test.o = -I$(src)
>> +noinst_SCRIPTS = run
>> +EXTRA_DIST = run
>> diff --git a/tests/trace_event/run b/tests/trace_event/run
>> new file mode 100755
>> index 0000000..fa01c7a
>> --- /dev/null
>> +++ b/tests/trace_event/run
>> @@ -0,0 +1,5 @@
>> +#!/bin/sh
>> +
>> +# Run with nothing
>> +
>> +UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=../../libust/.libs:../../../liburcu $1 .libs/trace_event_test
>
> Might want to add UST_AUTOCOLLECT=0 here or else you need to start the
> ustd daemon for collecting data before.
>

Ok, will fix.

/Nils

> Thanks
> David
>
>> diff --git a/tests/trace_event/trace_event_test.c b/tests/trace_event/trace_event_test.c
>> new file mode 100644
>> index 0000000..63a67c5
>> --- /dev/null
>> +++ b/tests/trace_event/trace_event_test.c
>> @@ -0,0 +1,14 @@
>> +#include<stdio.h>
>> +#include<ust/clock.h>
>> +
>> +#define CREATE_TRACE_POINTS
>> +#include "trace_event_test.h"
>> +
>> +int main(int argc, char * argv[])
>> +{
>> +	static unsigned long time, i;
>> +	for (i=0; i<10; i++) {
>> +		time=trace_clock_read64();
>> +		trace_test(time, i);
>> +	}
>> +}
>> diff --git a/tests/trace_event/trace_event_test.h b/tests/trace_event/trace_event_test.h
>> new file mode 100644
>> index 0000000..28eab5e
>> --- /dev/null
>> +++ b/tests/trace_event/trace_event_test.h
>> @@ -0,0 +1,34 @@
>> +#undef TRACE_SYSTEM
>> +#define TRACE_SYSTEM trace_event_test
>> +
>> +#if !defined(_TRACE_EVENT_TEST_H) || defined(TRACE_HEADER_MULTI_READ)
>> +#define _TRACE_EVENT_TEST_H
>> +
>> +#include<ust/tracepoint.h>
>> +
>> +TRACE_EVENT(test,
>> +
>> +	TP_PROTO(unsigned long time, unsigned long count),
>> +
>> +	TP_ARGS(time, count),
>> +
>> +	TP_STRUCT__entry(
>> +		__field(	unsigned long,	time	)
>> +		__field(	unsigned long,	count	)
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->time = time;
>> +		__entry->count = count;
>> +	),
>> +
>> +	TP_printf("time=%lu count=%lu", __entry->time, __entry->count)
>> +);
>> +
>> +#endif /* _TRACE_EVENT_TEST_H */
>> +
>> +/* This part must be outside protection */
>> +#undef TRACE_INCLUDE_PATH
>> +#define TRACE_INCLUDE_PATH .
>> +#define TRACE_INCLUDE_FILE trace_event_test
>> +#include<ust/define_trace.h>
>
> -- 
> David Goulet
> LTTng project, DORSAL Lab.
>
> PGP/GPG : 1024D/16BD8563
> BE3C 672B 9331 9796 291A  14C6 4AF7 C14B 16BD 8563
>




      reply	other threads:[~2010-08-25  6:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24 11:05 Nils Carlson
2010-08-24 15:44 ` David Goulet
2010-08-25  6:14   ` Nils Carlson [this message]

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=alpine.DEB.2.00.1008250813480.7660@as68123.uab.ericsson.se \
    --to=nils.carlson@ericsson.com \
    /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