src.ctf.fs: emit discarded events/packets messages
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 14 Feb 2019 23:12:34 +0000 (18:12 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:38 +0000 (18:19 -0400)
commit989925d16d3afe61de5ca7fed012b686bb480344
treeb79d03ead604333682522227342db80ef2134359
parentbbbd35bfddcc553841247030146846155f36fb39
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.025638 seconds and 4 git commands to generate.