lib: iterator auto-seeking: handle intersecting discarded items messages
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 27 Feb 2019 19:16:51 +0000 (14:16 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:38 +0000 (18:19 -0400)
commit3d902f171cc62ce6ac5f39b1f29e4ab9ae793e28
tree25d17e33664e32c6f2227c4ab829e86e0faad714
parentc0c2ed348333d47d344c0cd36d34599c01eea75b
lib: iterator auto-seeking: handle intersecting discarded items messages

This patch makes the message iterator auto-seeking algorithm handle
discarded events and packets messages of which the seeking time
intersects the message's time range, for example:

    discarded events
    msg
    v                  |
    ===*=========*=*===|==*== *      * *
       ^ event msg     |
                       ^ seeking time

In this scenario, we obviously don't want to keep the three event
messages which occur before the seeking time, but we want to keep a part
of the discarded events message because discarding it entirely (as it
was done before this patch) leads to information loss, i.e.:

                       |
                       |  *   *      * *
                       |

Instead, when this happens, we set the discarded events/packets
message's beginning time to the seeking time, make its count
unavailable, and we keep the message:

                       |
                       |==*== *      * *
                       |

The message iterator's internal auto-seeking message array is replaced
with a message queue as there can be more messages in this queue than
the iterator's message array capacity now. Because of this, the
post-seeking temporary "next" method fills the output message array as
long as messages exist in the auto-seeking message queue. When the
message queue is finally empty, it resets the iterator's "next" method
to the original user method.

Because setting a discarded items message's beginning time to a seeking
time (in nanoseconds from origin) requires a conversion from nanoseconds
from origin to a raw clock value, the internal
bt_clock_class_clock_value_from_ns_from_origin() utility is added. This
function can fail if there's an overflow in arithmetic operations.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
include/babeltrace/babeltrace-internal.h
include/babeltrace/graph/message-iterator-internal.h
include/babeltrace/trace-ir/clock-class-internal.h
lib/graph/iterator.c
This page took 0.024897 seconds and 4 git commands to generate.