src.ctf.fs: emit discarded events/packets messages
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 14 Feb 2019 23:12:34 +0000 (18:12 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
commit495490c50c000cf3ae2c08f6a5e175ef2c25fa5d
tree0c716e9b3c5f9705bcaa443c4b45e6f7118aa66c
parentfc917f653bcf48c71524b7c0a83eff09612f597c
src.ctf.fs: emit discarded events/packets messages

Make a `src.ctf.fs` message iterator emit appropriate discarded events
and packets messages when needed. For the moment the information is
redundant with the equivalent counters within `bt_packet` objects, but
those will be removed eventually before 2.0-rc1.

To avoid getting a discarded packets message (therefore a warning with
`sink.text.pretty`) for any partial trace, like it's the case with LTTng
snapshots, it is not emitted when a stream's first packet's sequence
number is not 0.

However, if the stream's first packet's discarded event counter is
greater than 0, a discarded events message is emitted, indicating an
unknown number of discarded events between the packet's beginning time
and the packet's end time. I believe this is the best approximation we
can get for this exceptional scenario.

I refactored some states of `msg-iter.c`, adding states dedicated to
check if we have to emit or not some types of messages. Emitting or not
stream beginning/end and stream activity beginning/end messages is
handled by such states now: for example,
check_emit_msg_stream_beginning_state() sets the current state to
`STATE_EMIT_MSG_STREAM_BEGINNING` or
`STATE_CHECK_EMIT_MSG_DISCARDED_EVENTS` depending on how
bt_msg_iter_set_emit_stream_beginning_message() was called the last
time. This makes bt_msg_iter_get_next_message() unconditionally create
messages when getting emitting states, as some are completely skipped by
the checking states. The `STATE_CHECK_EMIT_MSG_DISCARDED_EVENTS` checks
whether or not a discarded events message must be emitted, and
`STATE_CHECK_EMIT_MSG_DISCARDED_PACKETS` checks whether or not a
discarded packets message must be emitted.

Before a packet beginning message, a discarded events message can be
emitted, and then a discarded packets message can be emitted, in this
order.

As of this patch, all other component classes ignore those messages.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
plugins/ctf/common/msg-iter/msg-iter.c
plugins/ctf/common/msg-iter/msg-iter.h
plugins/ctf/fs-src/fs.c
This page took 0.025091 seconds and 4 git commands to generate.