lib: remove clock class priority map, use default clock value
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 31 Jul 2018 21:31:50 +0000 (17:31 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:07:36 +0000 (00:07 -0400)
commite22b45d0f7d3ce1311bf96a930bc42326f555202
tree778ddb4bc5a25f0a9244487c9e185a1fdefa7954
parentbf55043c2e742cafb86d3a3404d0d35c4cf294a3
lib: remove clock class priority map, use default clock value

This patch removes the concept (and associated files and functions) of
clock class priority maps. We're setting plain clock values to objects
which have a time (event, packet, some notifications) instead and using
a _default_ clock value. This is an easier API, and after all, all we
need is a clock value to sort notifications, not custom priorities
assigned to clock classes.

The purpose of the default clock value is to mux (sort) or trim
notifications, and also to seek eventually.

For an event object, the API is now:

    int bt_event_set_clock_value(struct bt_event *event,
        struct bt_clock_class *clock_class, uint64_t raw_value,
        bt_bool is_default);

    struct bt_clock_value *bt_event_borrow_default_clock_value(
        struct bt_event *event);

As of this version, when calling bt_event_set_clock_value() (or any
clock value setter), you must pass `BT_TRUE` as the `is_default`
parameter. That is, individual objects support at most a single, default
clock value. This is simpler now and can still change in the future.

Like before this patch, clock value objects are unique, that is, you
cannot get or put a clock value reference, but you can borrow it. You
cannot set a clock value object's raw value directly
(bt_clock_value_set_value()) anymore because this is done through
specific clock value setter functions.

Behind the scenes, all the objects with a clock value setter and
borrower function use an internal clock value set object. This is an
array of clock values with a pointer to the default one. Its API is:

    static inline
    int bt_clock_value_set_initialize(struct bt_clock_value_set *cv_set);

    static inline
    void bt_clock_value_set_reset(struct bt_clock_value_set *cv_set);

    static inline
    void bt_clock_value_set_finalize(struct bt_clock_value_set *cv_set);

    static inline
    int bt_clock_value_set_set_clock_value(
        struct bt_clock_value_set *cv_set,
        struct bt_clock_class *cc, uint64_t raw_value,
        bt_bool is_default);

You can reset a clock value set if it's located within a resettable
(poolable) object (e.g., event, packet).

The `bt_packet` object now has two clock value sets: its beginning and
end times. Although there is no developer mode check as of this patch,
the beginning and end times must match the `timestamp_begin` and
`timestamp_end` field values if they exist.

The stream beginning and end notification APIs have clock value setter
and borrower functions so that you can (optionally, if possible)
indicate the beginning and end times of a stream.

An `flt.utils.muxer` component now uses the default clock value of event
and inactivity notifications to sort notifications.

Discarded element (event, packet) notification types are removed because
they rely on the clock class priority map concept too and we're about to
remove them anyway and replace them with a new concept. Their usage is
temporarily removed from specific plugin component classes
(`src.text.pretty`, `sink.utils.counter`).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
56 files changed:
include/Makefile.am
include/babeltrace/babeltrace.h
include/babeltrace/ctf-ir/clock-value-internal.h
include/babeltrace/ctf-ir/clock-value-set-internal.h [new file with mode: 0644]
include/babeltrace/ctf-ir/clock-value.h
include/babeltrace/ctf-ir/event-class-internal.h
include/babeltrace/ctf-ir/event-internal.h
include/babeltrace/ctf-ir/event.h
include/babeltrace/ctf-ir/field-types-internal.h
include/babeltrace/ctf-ir/fields-internal.h
include/babeltrace/ctf-ir/packet-internal.h
include/babeltrace/ctf-ir/packet.h
include/babeltrace/graph/clock-class-priority-map-internal.h [deleted file]
include/babeltrace/graph/clock-class-priority-map.h [deleted file]
include/babeltrace/graph/notification-discarded-elements-internal.h [deleted file]
include/babeltrace/graph/notification-discarded-events.h [deleted file]
include/babeltrace/graph/notification-discarded-packets.h [deleted file]
include/babeltrace/graph/notification-event-internal.h
include/babeltrace/graph/notification-event.h
include/babeltrace/graph/notification-inactivity-internal.h
include/babeltrace/graph/notification-inactivity.h
include/babeltrace/graph/notification-internal.h
include/babeltrace/graph/notification-stream-internal.h
include/babeltrace/graph/notification-stream.h
include/babeltrace/graph/notification.h
lib/ctf-ir/clock-class.c
lib/ctf-ir/event-class.c
lib/ctf-ir/event.c
lib/ctf-ir/packet.c
lib/ctf-ir/stream-class.c
lib/graph/Makefile.am
lib/graph/clock-class-priority-map.c [deleted file]
lib/graph/iterator.c
lib/graph/notification/Makefile.am
lib/graph/notification/discarded-elements.c [deleted file]
lib/graph/notification/event.c
lib/graph/notification/inactivity.c
lib/graph/notification/stream.c
lib/lib-logging.c
lib/values.c
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/notif-iter/notif-iter.c
plugins/ctf/common/notif-iter/notif-iter.h
plugins/ctf/fs-src/data-stream-file.c
plugins/ctf/fs-src/fs.c
plugins/text/dmesg/dmesg.c
plugins/text/pretty/pretty.c
plugins/text/pretty/pretty.h
plugins/text/pretty/print.c
plugins/utils/counter/counter.c
plugins/utils/counter/counter.h
plugins/utils/muxer/muxer.c
tests/lib/Makefile.am
tests/lib/test_bt_notification_iterator.c
tests/lib/test_cc_prio_map.c [deleted file]
tests/plugins/test-utils-muxer.c
This page took 0.0299 seconds and 4 git commands to generate.