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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Oct 2019 17:27:58 +0000 (13:27 -0400)
commitc0e46a7c2b7bdd588eb716191940bf5b34f9fc5b
treed3a7a901f4b3fc669eb3c491dde6676d09fe98d0
parent90a8a0f23a364a3e1e3b7702c57b9c22473500a3
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.025235 seconds and 4 git commands to generate.