From a2540e85d328c6763e06ac5a9d952ed9fb51d251 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 20 Oct 2014 14:36:45 -0400 Subject: [PATCH] Add trace accessor to CTF Writer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/writer/writer.c | 14 ++++++++++++++ include/babeltrace/ctf-writer/writer.h | 11 +++++++++++ 2 files changed, 25 insertions(+) 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. * -- 2.34.1