ctf: decoding: accommodate LTTng `event-after-packet` timestamp quirk
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 26 Jun 2019 22:06:23 +0000 (18:06 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 16 Aug 2019 15:35:50 +0000 (11:35 -0400)
See prior commit titled:
  src.ctf.fs: index: accommodate bug in LTTng tracers
for an explanation of the non-compliance of some LTTng traces.

How this commit fixes the decoding for the affected traces
==========================================================
When about to emit a packet end message, check if the said packet is
affect by LTTng's `event-after-packet` bug. If it's the case, omit to
update the default_clock_snapshot to the `timestamp_end` of the packet.
This will expand the packet time span to the contain all its events.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I205caf0243c1d6f270bdb1b6508bb55a0806ba19
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1550
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/common/metadata/ctf-meta.h
src/plugins/ctf/common/msg-iter/msg-iter.c
src/plugins/ctf/fs-src/fs.c

index 884fe69ebfdf166e4230648080bdba2e44ad551c..798c3b6a4ee33bdbdcb91dc4fc011479dbaeecca 100644 (file)
@@ -313,6 +313,7 @@ struct ctf_trace_class {
 
        struct {
                bool lttng_crash;
+               bool lttng_event_after_packet;
        } quirks;
 };
 
index 404119facf12950926482e184bb50f475f0b65df..537ad1367df9d5676b6dc58095e21a536d87c963 100644 (file)
@@ -2550,6 +2550,24 @@ void create_msg_packet_end(struct bt_msg_iter *notit, bt_message **message)
                }
        }
 
+       /*
+        * Check if may be affected by lttng event-after-packet `timestamp_end`
+        * quirk.
+        */
+       if (notit->meta.tc->quirks.lttng_event_after_packet) {
+               /*
+                * Check if `timestamp_end` is smaller then the current
+                * default_clock_snapshot (which is set to the last event
+                * decoded). It means the trace is affected by the lttng
+                * `event-after-packet` packet `timestamp_end` quirk and must
+                * be fixed up by omitting to update the default clock snapshot
+                * to the `timestamp_end` as is typically done.
+                */
+               if (notit->snapshots.end_clock < notit->default_clock_snapshot) {
+                       update_default_cs = false;
+               }
+       }
+
        /* Update default clock from packet's end time. */
        if (notit->snapshots.end_clock != UINT64_C(-1) && update_default_cs) {
                notit->default_clock_snapshot = notit->snapshots.end_clock;
index 8b6b54ea70f52e618bd0d14205df819c3bf0ad8b..d6ea57d9f6a879d541068bd579630123f5c57b67 100644 (file)
@@ -2236,6 +2236,7 @@ int fix_packet_index_tracer_bugs(struct ctf_fs_component *ctf_fs)
                                BT_LOGE_STR("Failed to fix LTTng event-after-packet bug.");
                                goto end;
                        }
+                       trace->metadata->tc->quirks.lttng_event_after_packet = true;
                }
 
                if (is_tracer_affected_by_barectf_event_before_packet_bug(
This page took 0.027486 seconds and 4 git commands to generate.