Fix: do not sample clock when closing/opening a packet for an event not fitting
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 25 Mar 2019 20:05:13 +0000 (16:05 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 25 Mar 2019 20:05:23 +0000 (16:05 -0400)
commit27bc6f1e6265a0da01d8f1cf2d669f1a1537c47e
treec0828df32b4e4b4c2555e2ab52a47814658f9f1e
parentacfb82135f8799c401ad696d7ca3ee6bacd5c5f0
Fix: do not sample clock when closing/opening a packet for an event not fitting

This patch adds members to the generated barectf context to save the
current (becomes last) event's timestamp and use it when closing and
opening packets when the event does not fit the current packet instead
of sampling the clock again.

Without this patch, with this scenario:

1. Application calls a tracing function.
2. Tracing function samples the clock.
3. Event does not fit the current packet size: current packet is closed,
   sampling the clock, and new packet is opened, also sampling the
   clock.
4. Event is serialized to the new packet.

The new packet's timestamp is greater than its first event's timestamp,
because this event's timestamp is the result of sampling the clock
before sampling it to close the current packet and open a new one.

Babeltrace 1 accepts and reads the resulting stream, but Babeltrace 2's
muxer is more strict and refuses a message which is in the past.

Signed-off-by: Philippe Proulx <pproulx@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/gen.py
barectf/templates.py
This page took 0.024812 seconds and 4 git commands to generate.