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)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
commit5b9e151d6a8c0327e67bca1706ef16525d1d319d
treef3b07940e72d764291bd2e0a87e993dc2ea70ec5
parent7fcdb0a96f75d66f5ff4f32d3ca78d7ca6067e4c
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.025096 seconds and 4 git commands to generate.