ctf: index: accommodate lttng-crash timestamp quirk
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 14 Jun 2019 19:56:50 +0000 (15:56 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:22 +0000 (11:58 -0400)
commit7645f10f90890b9d7177b1d6799a9799135cf986
treefebe7ff0e2d276db929076892d3fa31f10ef1b2a
parentc2f376997bb70c7c4261f3c416cd76f97864989d
ctf: index: accommodate lttng-crash timestamp quirk

This commit is to accommodate the indexing of non-compliant CTF traces
produced by LTTng tracers and extracted by the lttng-crash utility.

What makes those traces non-compliant ?
=======================================
The lttng-crash is used to extract a trace from the tracing buffers from
non-volatile memory following a system crash. Because a system crash can
happen at any time, it's possible that some tracing packets might not
have been closed properly. It's possible to observe this by looking at
the `timestamp_end` field of the packets. They might be left to their
initial value of 0 when their `timestamp_begin` are often larger than 0.

This has the higher level effect that affected packets have a
`timestamp_end` smaller than their `timestamp_begin`, as if their end
time was before the beginning time.

How this commit fixes the index for the affected traces
=====================================================
For each index entry, if the entry's `timestamp_end` is 0 and the
`timestamp_begin` is not 0:
 - If it's the stream file's last packet: set the packet index entry's end
   time to the packet's last event's time, if any, or to the packet's
   beginning time otherwise.
 - If it's not the stream file's last packet: set the packet index
   entry's end time to the next packet's beginning time.

Affected versions
=================
All current and future lttng-ust and lttng-modules versions are affect
because this really cannot be fixed by the tracers because lttng-crash
only tries to make the most of a critical situation (i.e. a system
crash).

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib6ff9683b676983d8691f514f4d6c3e5c8c7e071
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1436
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/fs-src/fs.c
This page took 0.025195 seconds and 4 git commands to generate.