Fix: stream.c: autopopulate timestamp fields even when not mapped to CC
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 9 Nov 2017 17:35:27 +0000 (12:35 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 23 Nov 2017 14:53:30 +0000 (09:53 -0500)
To remain backward compatible with Babeltrace 1's CTF writer,
automatically set the event header `timestamp` fields (when appending
the event) and packet context `timestamp_begin` and `timestamp_end`
fields (on stream flush) when the stream's class has a registered CTF
writer clock, even if the field's types are not mapped to a clock class.

If the field is mapped to a clock class, then it is automatically set
when this mapped clock class is the same as the stream's class's clock's
class.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
lib/ctf-ir/stream.c

index 05c3231120fba94b9552749e622dbff25e9036ba..88e726ca2992f12c55d3dd4ee7a1f96f047a124f 100644 (file)
@@ -495,16 +495,7 @@ int set_packet_context_timestamp_field(struct bt_stream *stream,
 
        field_mapped_clock_class =
                bt_field_type_integer_get_mapped_clock_class(field->type);
-       if (!field_mapped_clock_class) {
-               BT_LOGV("Packet context's `%s` field's type is not mapped to a clock class: skipping: "
-                       "stream-addr=%p, stream-name=\"%s\", "
-                       "field-addr=%p, ft-addr=%p", field_name,
-                       stream, bt_stream_get_name(stream),
-                       field, field->type);
-               goto end;
-       }
-
-       if (field_mapped_clock_class !=
+       if (field_mapped_clock_class && field_mapped_clock_class !=
                        stream->stream_class->clock->clock_class) {
                BT_LOGV("Packet context's `%s` field's type is not mapped to the stream's clock's class: skipping: "
                        "stream-addr=%p, stream-name=\"%s\", "
@@ -1212,7 +1203,8 @@ static int auto_populate_event_header(struct bt_stream *stream,
                mapped_clock_class =
                        bt_field_type_integer_get_mapped_clock_class(
                                timestamp_field->type);
-               if (mapped_clock_class == stream_class_clock_class) {
+               if (!mapped_clock_class ||
+                               mapped_clock_class == stream_class_clock_class) {
                        uint64_t timestamp;
 
                        ret = bt_ctf_clock_get_value(
This page took 0.025191 seconds and 4 git commands to generate.