X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Ffs-sink%2Ffs-sink-ctf-meta.h;h=72d47d4aaf53313925039d66b85546f048e9603f;hb=26fc5aedf;hp=6ae88dfb026e6546bf59bef9a89ad618e00141b4;hpb=578e048b5debf169e286e5b5cc747b5d6c16886d;p=babeltrace.git diff --git a/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h b/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h index 6ae88dfb..72d47d4a 100644 --- a/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h +++ b/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h @@ -18,7 +18,7 @@ #include #include "common/common.h" #include "common/assert.h" -#include "compat/uuid.h" +#include "common/uuid.h" #include #include #include @@ -120,11 +120,11 @@ struct fs_sink_ctf_event_class { struct fs_sink_ctf_field_class *payload_fc; }; -struct fs_sink_ctf_trace_class; +struct fs_sink_ctf_trace; struct fs_sink_ctf_stream_class { /* Weak */ - struct fs_sink_ctf_trace_class *tc; + struct fs_sink_ctf_trace *trace; /* Weak */ const bt_stream_class *ir_sc; @@ -133,6 +133,7 @@ struct fs_sink_ctf_stream_class { const bt_clock_class *default_clock_class; GString *default_clock_class_name; + bool has_packets; bool packets_have_ts_begin; bool packets_have_ts_end; bool has_discarded_events; @@ -155,11 +156,14 @@ struct fs_sink_ctf_stream_class { GHashTable *event_classes_from_ir; }; -struct fs_sink_ctf_trace_class { +struct fs_sink_ctf_trace { + /* Weak */ + const bt_trace *ir_trace; + /* Weak */ const bt_trace_class *ir_tc; - unsigned char uuid[BABELTRACE_UUID_LEN]; + bt_uuid_t uuid; /* Array of `struct fs_sink_ctf_stream_class *` (owned by this) */ GPtrArray *stream_classes; @@ -715,16 +719,16 @@ void fs_sink_ctf_event_class_destroy(struct fs_sink_ctf_event_class *ec) static inline struct fs_sink_ctf_stream_class *fs_sink_ctf_stream_class_create( - struct fs_sink_ctf_trace_class *tc, + struct fs_sink_ctf_trace *trace, const bt_stream_class *ir_sc) { struct fs_sink_ctf_stream_class *sc = g_new0(struct fs_sink_ctf_stream_class, 1); - BT_ASSERT(tc); + BT_ASSERT(trace); BT_ASSERT(ir_sc); BT_ASSERT(sc); - sc->tc = tc; + sc->trace = trace; sc->ir_sc = ir_sc; sc->default_clock_class = bt_stream_class_borrow_default_clock_class_const(ir_sc); @@ -736,6 +740,7 @@ struct fs_sink_ctf_stream_class *fs_sink_ctf_stream_class_create( sc->event_classes_from_ir = g_hash_table_new(g_direct_hash, g_direct_equal); BT_ASSERT(sc->event_classes_from_ir); + sc->has_packets = bt_stream_class_supports_packets(ir_sc); sc->packets_have_ts_begin = bt_stream_class_packets_have_beginning_default_clock_snapshot( ir_sc); @@ -756,7 +761,7 @@ struct fs_sink_ctf_stream_class *fs_sink_ctf_stream_class_create( ir_sc); } - g_ptr_array_add(tc->stream_classes, sc); + g_ptr_array_add(trace->stream_classes, sc); return sc; } @@ -798,42 +803,37 @@ void fs_sink_ctf_stream_class_append_event_class( } static inline -void fs_sink_ctf_trace_class_destroy(struct fs_sink_ctf_trace_class *tc) +void fs_sink_ctf_trace_destroy(struct fs_sink_ctf_trace *trace) { - if (!tc) { + if (!trace) { return; } - if (tc->stream_classes) { - g_ptr_array_free(tc->stream_classes, TRUE); - tc->stream_classes = NULL; + if (trace->stream_classes) { + g_ptr_array_free(trace->stream_classes, TRUE); + trace->stream_classes = NULL; } - g_free(tc); + g_free(trace); } static inline -struct fs_sink_ctf_trace_class *fs_sink_ctf_trace_class_create( - const bt_trace_class *ir_tc) +struct fs_sink_ctf_trace *fs_sink_ctf_trace_create(const bt_trace *ir_trace) { - struct fs_sink_ctf_trace_class *tc = - g_new0(struct fs_sink_ctf_trace_class, 1); + struct fs_sink_ctf_trace *trace = + g_new0(struct fs_sink_ctf_trace, 1); - BT_ASSERT(tc); + BT_ASSERT(trace); - if (bt_uuid_generate(tc->uuid)) { - fs_sink_ctf_trace_class_destroy(tc); - tc = NULL; - goto end; - } + bt_uuid_generate(trace->uuid); - tc->ir_tc = ir_tc; - tc->stream_classes = g_ptr_array_new_with_free_func( + trace->ir_trace = ir_trace; + trace->ir_tc = bt_trace_borrow_class_const(ir_trace); + trace->stream_classes = g_ptr_array_new_with_free_func( (GDestroyNotify) fs_sink_ctf_stream_class_destroy); - BT_ASSERT(tc->stream_classes); + BT_ASSERT(trace->stream_classes); -end: - return tc; + return trace; } static inline