From: Nils Carlson Date: Wed, 8 Sep 2010 14:54:48 +0000 (+0200) Subject: Add trace_event library initialisation X-Git-Tag: v0.8~22 X-Git-Url: http://git.lttng.org/?p=ust.git;a=commitdiff_plain;h=3c6eae02c4bd3cea00113ca9dbccf753113ffc6d Add trace_event library initialisation Add library initialisation with dummy trace_event in order to create sections. --- diff --git a/Makefile.am b/Makefile.am index c77ef8f..5132d59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I config # the linker script. SUBDIRS = snprintf libustcomm libustcmd libust . tests libustinstr-malloc libustd ustd ustctl libustfork include doc -EXTRA_DIST = libust.ldscript.in libust-initializer.c +EXTRA_DIST = libust.ldscript.in libust-initializer.c libust-initializer.h dist_bin_SCRIPTS = usttrace ldscriptsdir = $(libdir) @@ -21,4 +21,4 @@ libust.so: libust.ldscript.in # It is very important to compile the initializer with PIC otherwise we # may get obscure errors when linking to shared libraries. libust-initializer.o: libust-initializer.c - $(CC) $(CFLAGS) -fno-strict-aliasing -fPIC -c -I$(top_srcdir)/include -o $@ $< + $(CC) $(CFLAGS) -fno-strict-aliasing -fPIC -c -I$(top_srcdir)/include -I$(top_srcdir) -o $@ $< diff --git a/libust-initializer.c b/libust-initializer.c index 390218e..2ac5637 100644 --- a/libust-initializer.c +++ b/libust-initializer.c @@ -21,12 +21,17 @@ DECLARE_TRACE(ust_dummytp, TP_PROTO(int anint), TP_ARGS(anint)); DEFINE_TRACE(ust_dummytp); +#define CREATE_TRACE_POINTS +#include "libust-initializer.h" + void dummy_libust_initializer_func(void) { int i; trace_mark(ust, dummymark, MARK_NOARGS); trace_ust_dummytp(i); + trace_ust_dummy_event(i); } MARKER_LIB; TRACEPOINT_LIB; +TRACE_EVENT_LIB; diff --git a/libust-initializer.h b/libust-initializer.h new file mode 100644 index 0000000..b5d88ac --- /dev/null +++ b/libust-initializer.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2010 Nils Carlson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ust_dummy + +#if !defined(_TRACE_EVENT_TEST_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_EVENT_TEST_H + +#include + +TRACE_EVENT(ust_dummy_event, + + TP_PROTO(int dummy_int), + + TP_ARGS(dummy_int), + + TP_STRUCT__entry( + __field( int, dummy ) + ), + + TP_fast_assign( + __entry->dummy = dummy_int; + ), + + TP_printf("dummy=%d", __entry->dummy) +); + +#endif /* _TRACE_EVENT_TEST_H */ + +/* This part must be outside protection */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE libust-initializer +#include