barectf-platform-linux-fs.o: $(PLATFORM_DIR)/barectf-platform-linux-fs.c
$(CC) $(CFLAGS) -c $<
-$(TARGET).o: barectf-tracepoint.c barectf.h barectf-bitfield.h
+$(TARGET).o: barectf-tracepoint.c barectf-tracepoint-linux-fs.h barectf.h barectf-bitfield.h
$(CC) -o $@ $(CFLAGS) -c $<
clean:
tp.o: tp.c
$(CC) -c $(CFLAGS) -I. $<
-$(TARGET).o: barectf-tracepoint.c tp.h
+$(TARGET).o: barectf-tracepoint.c barectf-tracepoint-lttng-ust.h tp.h
$(CC) -c -o $@ $(CFLAGS) -DWITH_LTTNG_UST=1 $<
clean:
--- /dev/null
+#ifndef _BARECTF_TRACEPOINT_LINUX_FS
+#define _BARECTF_TRACEPOINT_LINUX_FS
+
+#include <barectf-platform-linux-fs.h>
+
+/*
+ * Include generated barectf header file: this contains the prefix and
+ * default stream name to be used by the tracepoint() macro.
+ */
+#include "barectf.h"
+
+/* define how the context is to be found by tracepoint() calls */
+#define BARECTF_TRACEPOINT_CTX (global_barectf_ctx)
+
+/* then include this: */
+#include <barectf-tracepoint.h>
+
+/* global barectf context (default stream) */
+static struct barectf_default_ctx *global_barectf_ctx;
+
+/* global barectf platform context */
+static struct barectf_platform_linux_fs_ctx *global_barectf_platform_ctx;
+
+/* init function for this version */
+static void init_tracing(void)
+{
+ /* initialize platform */
+ global_barectf_platform_ctx =
+ barectf_platform_linux_fs_init(512, "ctf", 1, 2, 7);
+
+ if (!global_barectf_platform_ctx) {
+ fprintf(stderr, "Error: could not initialize platform\n");
+ exit(1);
+ }
+
+ global_barectf_ctx = barectf_platform_linux_fs_get_barectf_ctx(
+ global_barectf_platform_ctx);
+}
+
+/* finalization function for this version */
+static void fini_tracing(void)
+{
+ /* finalize platform */
+ barectf_platform_linux_fs_fini(global_barectf_platform_ctx);
+}
+
+#endif /* _BARECTF_TRACEPOINT_LINUX_FS */
--- /dev/null
+#ifndef _BARECTF_TRACEPOINT_LTTNG_UST
+#define _BARECTF_TRACEPOINT_LTTNG_UST
+
+/* tracepoint provider header */
+#include "tp.h"
+
+/* empty init() and fini() function for this version */
+#define init_tracing()
+#define fini_tracing()
+
+#endif /* _BARECTF_TRACEPOINT_LTTNG_UST */
#include <stdlib.h>
#include <time.h>
-#ifdef WITH_LTTNG_UST
-#include "tp.h"
-#else /* #ifdef WITH_LTTNG_UST */
-#include <barectf-platform-linux-fs.h>
-
-/*
- * Include generated barectf header file: this contains the prefix and
- * default stream name to be used by the tracepoint() macro.
- */
-#include "barectf.h"
-
-/* define how the context is to be found by tracepoint() calls */
-#define BARECTF_TRACEPOINT_CTX (global_barectf_ctx)
-
-/* then include this: */
-#include <barectf-tracepoint.h>
-
-/* global barectf context (default stream) */
-static struct barectf_default_ctx *global_barectf_ctx;
-
-/* global barectf platform context */
-struct barectf_platform_linux_fs_ctx *global_barectf_platform_ctx;
-#endif /* #ifdef WITH_LTTNG_UST */
+#if defined(WITH_LTTNG_UST)
+#include "barectf-tracepoint-lttng-ust.h"
+#else
+#include "barectf-tracepoint-linux-fs.h"
+#endif
enum state_t {
NEW,
}
}
-#ifdef WITH_LTTNG_UST
-#define init_barectf()
-#define fini_barectf()
-#else /* #ifdef WITH_LTTNG_UST */
-static void init_barectf(void)
-{
- /* initialize platform */
- global_barectf_platform_ctx =
- barectf_platform_linux_fs_init(512, "ctf", 1, 2, 7);
-
- if (!global_barectf_platform_ctx) {
- fprintf(stderr, "Error: could not initialize platform\n");
- exit(1);
- }
-
- global_barectf_ctx = barectf_platform_linux_fs_get_barectf_ctx(
- global_barectf_platform_ctx);
-}
-
-static void fini_barectf(void)
-{
- /* finalize platform */
- barectf_platform_linux_fs_fini(global_barectf_platform_ctx);
-}
-#endif /* #ifdef WITH_LTTNG_UST */
-
int main(int argc, char *argv[])
{
- init_barectf();
+ init_tracing();
trace_stuff(argc, argv);
- fini_barectf();
+ fini_tracing();
return 0;
}