lib: allow a single mapped clock class within a stream class
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 31 Jan 2018 21:17:19 +0000 (16:17 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 03:32:03 +0000 (23:32 -0400)
commit2a3ced3c38855ea18eb9b29e58563a7301b98216
treea0622a7f84f6946233a9eca2e1250aa5564b091b
parent4a2fffdb3c120ac5f16d4308b2da375fbe9def20
lib: allow a single mapped clock class within a stream class

This patch makes it illegal to have more than one mapped clock class
within the field types of a stream class and all its event classes. Many
field types can map to the same, unique clock class.

Multiple clock classes within a given stream class is not a well-defined
nor well-supported feature, if it is one in the first place, of CTF.
Considering the known use cases we have in the field, it is not used
either. A clock's value should be reset to the value of the
`timestamp_begin` field of the packet's context for each packet, but
this field can only be mapped to a single clock class anyway. What
should its initial value be in this case? The specification is silent on
this matter.

We keep an "expected" clock class in the stream class object. This is
only valid when the stream class is frozen; otherwise, the stream
class's field types can change, even when event classes are already part
of it. If the stream class is already frozen, then if the expected clock
class is still NULL (no mapped clock class at this point), an added
event class can set it (for future added event classes).

If the stream class is eventually part of a trace which was created by a
CTF writer, we make sure that the expected clock class is the stream
class's clock's class, if any. This is important because, in
bt_trace_add_stream_class(), on success, we try to map some special
fields to the stream's clock's class. Because we know at this point that
the stream's clock's class is also the stream class's expected clock
class, it is safe to perform this mapping once the single clock class
validation is already done.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
include/babeltrace/ctf-ir/event-class-internal.h
include/babeltrace/ctf-ir/stream-class-internal.h
lib/ctf-ir/event-class.c
lib/ctf-ir/event.c
lib/ctf-ir/stream-class.c
lib/ctf-ir/trace.c
lib/ctf-ir/utils.c
This page took 0.026382 seconds and 4 git commands to generate.