[lttng-dev] lost events in a trace

Philippe Proulx eeppeliteloop at gmail.com
Tue Jun 13 15:31:19 UTC 2017


On Mon, Jun 12, 2017 at 6:21 PM, Deneau, Tom <tom.deneau at amd.com> wrote:
>
> I am using the babeltrace python3 bindings on a trace collected with event-loss-mode
> set to discard.  The tracecollection is a combination of a kernel channel and a usermode
> channel. How can I tell whether there are any lost events in this trace?

Hello Tom.

Unfortunately, the `babeltrace` Python module/package does not offer
an API to check for discarded events directly.

What you could try is to check the packet context's `events_discarded`
field for each event (not tested):

    from babeltrace import CTFScope

    for event in my_trace_collection.events:
        ed_field = event.field_with_scope('events_discarded',
                                          CTFScope.STREAM_PACKET_CONTEXT)

        if ed_field is not None and ed_field != 0:
            path = event.handle.path
            print('{} discarded events so far in `{}`.'.format(ed_field, path))

Babeltrace 2 will offer an API (with both the native C/C++ API and the
Python bindings) to check this more naturally. Basically, with the
Babeltrace 2 API, you do not iterate on events only, but on other
notifications as well, some of them being dicarded events (at tracing
time) and discarded packets (at tracing time). The upcoming `bt2` Python
package is not available yet as of Babeltrace 2.0.0-pre1, the current
release as of this date.

Hope it helps,
Phil

>
> -- Tom Deneau
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


More information about the lttng-dev mailing list