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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:33 +0000 (18:19 -0400)
commit8c4a29bac9fdec710f70395f51e214cf25f14799
treeeeb054cd6fc4a24bb9e8c6db350f8b9c9ebc4b4e
parent59d1efc4ca30e0c68df57fdb8ce3b52deabaf151
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.02606 seconds and 4 git commands to generate.