From: Jérémie Galarneau Date: Mon, 20 Oct 2014 18:36:45 +0000 (-0400) Subject: Add trace accessor to CTF Writer X-Git-Tag: v2.0.0-pre1~1469 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=a2540e85d328c6763e06ac5a9d952ed9fb51d251 Add trace accessor to CTF Writer Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/writer/writer.c b/formats/ctf/writer/writer.c index 7b876617..ed896ca4 100644 --- a/formats/ctf/writer/writer.c +++ b/formats/ctf/writer/writer.c @@ -131,6 +131,20 @@ void bt_ctf_writer_destroy(struct bt_ctf_ref *ref) g_free(writer); } +struct bt_ctf_trace *bt_ctf_writer_get_trace(struct bt_ctf_writer *writer) +{ + struct bt_ctf_trace *trace = NULL; + + if (!writer) { + goto end; + } + + trace = writer->trace; + bt_ctf_trace_get(trace); +end: + return trace; +} + struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, struct bt_ctf_stream_class *stream_class) { diff --git a/include/babeltrace/ctf-writer/writer.h b/include/babeltrace/ctf-writer/writer.h index 0705b05f..f6051b4e 100644 --- a/include/babeltrace/ctf-writer/writer.h +++ b/include/babeltrace/ctf-writer/writer.h @@ -31,6 +31,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { @@ -53,6 +54,16 @@ struct bt_ctf_clock; */ extern struct bt_ctf_writer *bt_ctf_writer_create(const char *path); +/* + * bt_ctf_writer_get_trace: Get a writer's associated trace. + * + * @param writer Writer instance. + * + * Return the writer's associated instance, NULL on error. + */ +extern struct bt_ctf_trace *bt_ctf_writer_get_trace( + struct bt_ctf_writer *writer); + /* * bt_ctf_writer_create_stream: create a stream instance. *