lib: make can_seek_ns_from_origin logic use `can_seek_forward` property of iterator
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 18 Sep 2019 20:22:16 +0000 (16:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 9 Oct 2019 18:14:29 +0000 (14:14 -0400)
commitc49bf79b7d7e87cc21d065a7d208bcc238fb0800
tree60f8ea64d439c76155f0d2d22e307147a2827d7e
parentda1375faf157c03995f32c8503dc6d9bedb0d309
lib: make can_seek_ns_from_origin logic use `can_seek_forward` property of iterator

This patch changes the behavior of
bt_self_component_port_input_message_iterator_can_seek_ns_from_origin to
make use of the new `can_seek_forward` property of iterators.

The current iterator "can seek ns from origin" logic works like this:

- If the iterator provides a `can_seek_ns_from_origin` method, call it
  and return that result.
- Otherwise, check if we can autoseek: if the iterator can seek
  beginning return true, else return false.

An issue with this is that if:

- an iterator doesn't provide the can_seek_ns_from_origin and
  seek_ns_from_origin methods
- the streams (and thus event messages) produced by this iterator don't
  have a timestamp
- the iterator can seek beginning

then
bt_self_component_port_input_message_iterator_can_seek_ns_from_origin
will report that this iterator can seek ns from origin, presumably
because it can use autoseek.  However, since the event messages don't
have a timestamp, we'll be able to seek beginning, but fast forwarding
to the desired point won't work.

To solve this, we need an additional property on message iterators,
whether the messages it produces have a timestamp, and therefore if the
"fast-forward" portion of autoseek will work.

This patch also brings another behavior change.  Previously, if the
can_seek_ns_from_origin method of the iterator was provided and returned
false, that was it.  With this patch, if that happens, we fall back to
checking if autoseek is supported.  That change is primarily in
bt_self_component_port_input_message_iterator_can_seek_ns_from_origin.
However,
bt_self_component_port_input_message_iterator_seek_ns_from_origin is
also updated accordingly, because we need to query the iterator to know
if it can seek ns from origin by itself, or if we should fall back on
autoseek.

Change-Id: I1848c87acf8ed75d4020a51e3be41dec2f144843
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2066
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/bindings/python/bt2/bt2/message_iterator.py
src/lib/graph/iterator.c
src/plugins/ctf/fs-src/fs.c
src/plugins/lttng-utils/debug-info/debug-info.c
src/plugins/utils/muxer/muxer.c
src/plugins/utils/trimmer/trimmer.c
tests/bindings/python/bt2/test_message_iterator.py
tests/data/plugins/flt.utils.trimmer/bt_plugin_trimmer_test.py
This page took 0.024932 seconds and 4 git commands to generate.