From: Mathieu Desnoyers Date: Mon, 18 Jul 2011 20:17:29 +0000 (-0400) Subject: Add dummy output module X-Git-Tag: v0.1~3 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=22133895a9a6b29ec17211f8d437bc128a7e4dfc Add dummy output module Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index b6e8d650..eaa77606 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/converter/Makefile.am b/converter/Makefile.am index 794740d6..a47a18dc 100644 --- a/converter/Makefile.am +++ b/converter/Makefile.am @@ -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 = \ diff --git a/formats/Makefile.am b/formats/Makefile.am index 0bf5a74e..7f95fcc5 100644 --- a/formats/Makefile.am +++ b/formats/Makefile.am @@ -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 index 00000000..50ef9098 --- /dev/null +++ b/formats/bt-dummy/Makefile.am @@ -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 index 00000000..221b51ff --- /dev/null +++ b/formats/bt-dummy/bt-dummy.c @@ -0,0 +1,77 @@ +/* + * BabelTrace - Dummy Output + * + * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation + * + * Author: Mathieu Desnoyers + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 */