Add trace_event library initialisation
authorNils Carlson <nils.carlson@ericsson.com>
Wed, 8 Sep 2010 14:54:48 +0000 (16:54 +0200)
committerNils Carlson <nils.carlson@ericsson.com>
Fri, 10 Sep 2010 08:31:26 +0000 (10:31 +0200)
Add library initialisation with dummy trace_event in order
to create sections.

Makefile.am
libust-initializer.c
libust-initializer.h [new file with mode: 0644]

index c77ef8f03a74154197381465c688fe91d0b63b25..5132d59fc547db4d80270ca13179e6eb8f625189 100644 (file)
@@ -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 $@ $<
index 390218ee82c895185e5b33a5e0f6cbd164fa4566..2ac56375a32d90ecc2b1463070db49945bd7a7e3 100644 (file)
 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 (file)
index 0000000..b5d88ac
--- /dev/null
@@ -0,0 +1,48 @@
+/* Copyright (C) 2010 Nils Carlson <nils.carlson@ericsson.com>
+ *
+ * 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 <ust/tracepoint.h>
+
+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 <ust/define_trace.h>
This page took 0.02517 seconds and 4 git commands to generate.