Add dummy output module
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 18 Jul 2011 20:17:29 +0000 (16:17 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 18 Jul 2011 20:17:29 +0000 (16:17 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
converter/Makefile.am
formats/Makefile.am
formats/bt-dummy/Makefile.am [new file with mode: 0644]
formats/bt-dummy/bt-dummy.c [new file with mode: 0644]

index b6e8d6503bd820d0a6c3f5433b8f27926368d7d3..eaa77606edda79f5191a271af4957687033e3046 100644 (file)
@@ -56,6 +56,7 @@ AC_CONFIG_FILES([
        formats/ctf/types/Makefile
        formats/ctf-text/Makefile
        formats/ctf-text/types/Makefile
+       formats/bt-dummy/Makefile
        formats/ctf/metadata/Makefile
        converter/Makefile
        lib/Makefile
index 794740d65f0099058223066678d2e7eb9d97aba6..a47a18dcd23430bc2c37d0f7ca8b4d9d2ce921fd 100644 (file)
@@ -11,6 +11,7 @@ libbabeltrace_la_LIBADD = \
        $(top_builddir)/types/libbabeltrace_types.la \
        $(top_builddir)/formats/ctf/libctf.la \
        $(top_builddir)/formats/ctf-text/libctf-text.la \
+       $(top_builddir)/formats/bt-dummy/libbt-dummy.la \
        $(top_builddir)/lib/libprio_heap.la
 
 babeltrace_SOURCES = \
index 0bf5a74e88c9b287a8a5b17463bc46314fd4a874..7f95fcc5009f9bc11c163ef1730862fe447223c8 100644 (file)
@@ -1,6 +1,6 @@
 AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
 
-SUBDIRS = . ctf ctf-text
+SUBDIRS = . ctf ctf-text bt-dummy
 
 lib_LTLIBRARIES = libbabeltrace_registry.la
 
diff --git a/formats/bt-dummy/Makefile.am b/formats/bt-dummy/Makefile.am
new file mode 100644 (file)
index 0000000..50ef909
--- /dev/null
@@ -0,0 +1,9 @@
+AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
+
+lib_LTLIBRARIES = libbt-dummy.la
+
+libbt_dummy_la_SOURCES = \
+       bt-dummy.c
+
+libbt_dummy_la_LIBADD = \
+       ../libbabeltrace_registry.la
diff --git a/formats/bt-dummy/bt-dummy.c b/formats/bt-dummy/bt-dummy.c
new file mode 100644 (file)
index 0000000..221b51f
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * BabelTrace - Dummy Output
+ *
+ * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
+ *
+ * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#include <babeltrace/ctf-text/types.h>
+#include <babeltrace/format.h>
+#include <babeltrace/babeltrace.h>
+#include <inttypes.h>
+#include <uuid/uuid.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <glib.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+static
+int bt_dummy_write_event(struct stream_pos *ppos,
+                        struct ctf_stream *stream)
+{
+       return 0;
+}
+
+static
+struct trace_descriptor *bt_dummy_open_trace(const char *path, int flags)
+{
+       struct ctf_text_stream_pos *pos;
+
+       pos = g_new0(struct ctf_text_stream_pos, 1);
+       pos->parent.rw_table = NULL;
+       pos->parent.event_cb = bt_dummy_write_event;
+       return &pos->trace_descriptor;
+}
+
+static
+void bt_dummy_close_trace(struct trace_descriptor *td)
+{
+       struct ctf_text_stream_pos *pos =
+               container_of(td, struct ctf_text_stream_pos,
+                       trace_descriptor);
+       free(pos);
+}
+
+static
+struct format bt_dummy_format = {
+       .open_trace = bt_dummy_open_trace,
+       .close_trace = bt_dummy_close_trace,
+};
+
+static
+void __attribute__((constructor)) bt_dummy_init(void)
+{
+       int ret;
+
+       bt_dummy_format.name = g_quark_from_static_string("dummy");
+       ret = bt_register_format(&bt_dummy_format);
+       assert(!ret);
+}
+
+/* TODO: finalize */
This page took 0.026528 seconds and 4 git commands to generate.