lib: use object pool for event and packet notifications
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 4 Jun 2018 21:00:10 +0000 (17:00 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:05:45 +0000 (00:05 -0400)
commit5c5632787fc9cafa602c89a28966bcfd01ec0204
tree84cfba1048d679f2d7a872f99d6db984f8f49459
parent312c056ae3d374b253fa0cfe5ed576c0b0e5e569
lib: use object pool for event and packet notifications

This patch adds object pooling for event, packet beginning, and packet
end notifications.

The object pools are located in graph objects: there is one for each
notification type. All the notification creation functions (in case we
want to recycle other types of notification objects in the future) take
a graph object so that a notification recycling function can find the
appropriate object pool. I'm adding the convenient
bt_private_connection_private_notification_iterator_borrow_graph()
function for a notification iterator user function to borrow its graph
easily.

If the notification has a reference to its "creating" graph, there's a
possible reference cycle, for example:

* Graph -> connection -> notification iterator -> notification -> graph
* Graph -> component -> notification -> graph

To avoid this, the notification's graph link is weak, and the
notification creation function adds the notification to the graph's
array of notifications (also weak). While the graph is alive,
notification recycling functions are free to use the appropriate graph's
pool. When the graph is destroyed, all the notifications which have a
link to it are notified so that they "unlink" the graph. In this case,
notification recycling functions destroy the notification instead of
recycling it.

Some `bt_X_from_private()` functions are renamed to
`bt_X_borrow_from_private()` and do not return a new reference to make
it clearer.

Everything related to the notification heap API is removed because it is
not used anywhere and not needed since the `flt.utils.muxer` component
class does this.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
56 files changed:
include/Makefile.am
include/babeltrace/babeltrace.h
include/babeltrace/graph/component-internal.h
include/babeltrace/graph/component.h
include/babeltrace/graph/connection-internal.h
include/babeltrace/graph/graph-internal.h
include/babeltrace/graph/graph.h
include/babeltrace/graph/notification-discarded-elements-internal.h
include/babeltrace/graph/notification-event-internal.h
include/babeltrace/graph/notification-event.h
include/babeltrace/graph/notification-heap-internal.h [deleted file]
include/babeltrace/graph/notification-heap.h [deleted file]
include/babeltrace/graph/notification-inactivity.h
include/babeltrace/graph/notification-internal.h
include/babeltrace/graph/notification-iterator-internal.h
include/babeltrace/graph/notification-packet-internal.h
include/babeltrace/graph/notification-packet.h
include/babeltrace/graph/notification-stream.h
include/babeltrace/graph/port-internal.h
include/babeltrace/graph/private-component.h
include/babeltrace/graph/private-connection-private-notification-iterator.h
include/babeltrace/graph/private-connection.h
include/babeltrace/graph/private-port.h
lib/ctf-ir/stream-class.c
lib/graph/component.c
lib/graph/connection.c
lib/graph/filter.c
lib/graph/graph.c
lib/graph/iterator.c
lib/graph/notification/Makefile.am
lib/graph/notification/discarded-elements.c
lib/graph/notification/event.c
lib/graph/notification/heap.c [deleted file]
lib/graph/notification/inactivity.c
lib/graph/notification/notification.c
lib/graph/notification/packet.c
lib/graph/notification/stream.c
lib/graph/port.c
lib/graph/sink.c
lib/graph/source.c
lib/lib-logging.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/data-stream-file.h
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/fs.h
plugins/ctf/fs-src/query.c
plugins/text/dmesg/dmesg.c
plugins/utils/muxer/muxer.c
tests/Makefile.am
tests/lib/Makefile.am
tests/lib/test_bt_notification_heap.c [deleted file]
tests/lib/test_bt_notification_iterator.c
tests/lib/test_graph_topo.c
tests/plugins/test-utils-muxer.c
This page took 0.029436 seconds and 4 git commands to generate.