Babeltrace 2 C API 2.1.0
Open-source trace manipulation framework
Loading...
Searching...
No Matches
graph.h
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5 */
6
7#ifndef BABELTRACE2_GRAPH_GRAPH_H
8#define BABELTRACE2_GRAPH_GRAPH_H
9
10/* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11
12#ifndef __BT_IN_BABELTRACE_H
13# error "Please include <babeltrace2/babeltrace.h> instead."
14#endif
15
16#include <babeltrace2/types.h>
17#include <babeltrace2/logging.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
564extern bt_graph *bt_graph_create(uint64_t mip_version) __BT_NOEXCEPT;
565
597
605 const bt_component_class_source *component_class,
606 const char *name, const bt_value *params,
607 bt_logging_level logging_level,
608 const bt_component_source **component) __BT_NOEXCEPT;
609
692 bt_graph *graph,
693 const bt_component_class_source *component_class,
694 const char *name, const bt_value *params,
695 void *initialize_method_data, bt_logging_level logging_level,
696 const bt_component_source **component) __BT_NOEXCEPT;
697
705 const bt_component_class_filter *component_class,
706 const char *name, const bt_value *params,
707 bt_logging_level logging_level,
708 const bt_component_filter **component) __BT_NOEXCEPT;
709
792 bt_graph *graph,
793 const bt_component_class_filter *component_class,
794 const char *name, const bt_value *params,
795 void *initialize_method_data, bt_logging_level logging_level,
796 const bt_component_filter **component) __BT_NOEXCEPT;
797
805 bt_graph *graph, const bt_component_class_sink *component_class,
806 const char *name, const bt_value *params,
807 bt_logging_level logging_level,
808 const bt_component_sink **component) __BT_NOEXCEPT;
809
892 bt_graph *graph, const bt_component_class_sink *component_class,
893 const char *name, const bt_value *params,
894 void *initialize_method_data, bt_logging_level logging_level,
895 const bt_component_sink **component) __BT_NOEXCEPT;
896
928
971 bt_message_iterator *message_iterator,
972 void *user_data);
973
1010
1066 bt_message_iterator *message_iterator,
1067 void *user_data);
1068
1091typedef void (*bt_graph_simple_sink_component_finalize_func)(void *user_data);
1092
1155 void *user_data, const bt_component_sink **component) __BT_NOEXCEPT;
1156
1187
1242 const bt_port_output *upstream_port,
1243 const bt_port_input *downstream_port,
1244 const bt_connection **connection) __BT_NOEXCEPT;
1245
1262 BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK,
1263
1268 BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
1269
1274 BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1275
1280 BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
1282
1359extern bt_graph_run_status bt_graph_run(bt_graph *graph) __BT_NOEXCEPT;
1360
1370 BT_GRAPH_RUN_ONCE_STATUS_OK = __BT_FUNC_STATUS_OK,
1371
1376 BT_GRAPH_RUN_ONCE_STATUS_END = __BT_FUNC_STATUS_END,
1377
1382 BT_GRAPH_RUN_ONCE_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
1383
1388 BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1389
1394 BT_GRAPH_RUN_ONCE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
1396
1479
1504
1552 const bt_interrupter *interrupter) __BT_NOEXCEPT;
1553
1575 __BT_NOEXCEPT;
1576
1603
1629
1665 const bt_component_filter *component,
1666 const bt_port_input *port, void *user_data);
1667
1702 bt_graph *graph,
1704 void *user_data, bt_listener_id *listener_id) __BT_NOEXCEPT;
1705
1741 const bt_component_sink *component,
1742 const bt_port_input *port, void *user_data);
1743
1778 bt_graph *graph,
1780 void *user_data, bt_listener_id *listener_id) __BT_NOEXCEPT;
1781
1817 const bt_component_source *component,
1818 const bt_port_output *port, void *user_data);
1819
1854 bt_graph *graph,
1856 void *user_data, bt_listener_id *listener_id) __BT_NOEXCEPT;
1857
1893 const bt_component_filter *component,
1894 const bt_port_output *port, void *user_data);
1895
1930 bt_graph *graph,
1932 void *user_data, bt_listener_id *listener_id) __BT_NOEXCEPT;
1933
1956extern void bt_graph_get_ref(const bt_graph *graph) __BT_NOEXCEPT;
1957
1973extern void bt_graph_put_ref(const bt_graph *graph) __BT_NOEXCEPT;
1974
1989#define BT_GRAPH_PUT_REF_AND_RESET(_graph) \
1990 do { \
1991 bt_graph_put_ref(_graph); \
1992 (_graph) = NULL; \
1993 } while (0)
1994
2021#define BT_GRAPH_MOVE_REF(_dst, _src) \
2022 do { \
2023 bt_graph_put_ref(_dst); \
2024 (_dst) = (_src); \
2025 (_src) = NULL; \
2026 } while (0)
2027
2032#ifdef __cplusplus
2033}
2034#endif
2035
2036#endif /* BABELTRACE2_GRAPH_GRAPH_H */
uint64_t bt_listener_id
Numeric ID which identifies a user listener function.
Definition types.h:136
struct bt_component_class_sink bt_component_class_sink
Sink component class.
Definition types.h:27
struct bt_component_class_source bt_component_class_source
Source component class.
Definition types.h:28
struct bt_component_class_filter bt_component_class_filter
Filter component class.
Definition types.h:26
struct bt_component_filter bt_component_filter
Filter component.
Definition types.h:30
struct bt_component_source bt_component_source
Source component.
Definition types.h:32
struct bt_component_sink bt_component_sink
Sink component.
Definition types.h:31
struct bt_connection bt_connection
Connection.
Definition types.h:33
bt_graph_listener_func_status(* bt_graph_filter_component_input_port_added_listener_func)(const bt_component_filter *component, const bt_port_input *port, void *user_data)
User function for bt_graph_add_filter_component_input_port_added_listener().
Definition graph.h:1664
bt_graph_connect_ports_status
Status codes for bt_graph_connect_ports().
Definition graph.h:1168
void bt_graph_put_ref(const bt_graph *graph)
Decrements the reference count of the trace processing graph graph.
bt_graph_add_listener_status bt_graph_add_filter_component_input_port_added_listener(bt_graph *graph, bt_graph_filter_component_input_port_added_listener_func user_func, void *user_data, bt_listener_id *listener_id)
Adds a "filter component input port added" listener to the trace processing graph graph.
bt_graph_listener_func_status(* bt_graph_source_component_output_port_added_listener_func)(const bt_component_source *component, const bt_port_output *port, void *user_data)
User function for bt_graph_add_source_component_output_port_added_listener().
Definition graph.h:1816
bt_graph_add_component_status
Status codes for the bt_graph_add_*_component*() functions.
Definition graph.h:578
bt_graph_simple_sink_component_consume_func_status(* bt_graph_simple_sink_component_consume_func)(bt_message_iterator *message_iterator, void *user_data)
User consuming function for bt_graph_add_simple_sink_component().
Definition graph.h:1065
bt_graph_add_listener_status
Status codes for the bt_graph_add_*_component_*_port_added_listener() functions.
Definition graph.h:1590
bt_graph_add_interrupter_status bt_graph_add_interrupter(bt_graph *graph, const bt_interrupter *interrupter)
Adds the interrupter interrupter to all the current and future sink components and message iterators ...
bt_graph_add_component_status bt_graph_add_source_component(bt_graph *graph, const bt_component_class_source *component_class, const char *name, const bt_value *params, bt_logging_level logging_level, const bt_component_source **component)
Alias of bt_graph_add_source_component_with_initialize_method_data() with the initialize_method_data ...
bt_graph * bt_graph_create(uint64_t mip_version)
Creates a default, empty trace processing graph honouring version mip_version of the Message Intercha...
bt_graph_add_listener_status bt_graph_add_sink_component_input_port_added_listener(bt_graph *graph, bt_graph_sink_component_input_port_added_listener_func user_func, void *user_data, bt_listener_id *listener_id)
Adds a "sink component input port added" listener to the trace processing graph graph.
bt_graph_run_status
Status codes for bt_graph_run().
Definition graph.h:1257
bt_graph_add_component_status bt_graph_add_sink_component_with_initialize_method_data(bt_graph *graph, const bt_component_class_sink *component_class, const char *name, const bt_value *params, void *initialize_method_data, bt_logging_level logging_level, const bt_component_sink **component)
Creates a sink component from the class component_class with the initialization parameters params,...
bt_graph_simple_sink_component_initialize_func_status(* bt_graph_simple_sink_component_initialize_func)(bt_message_iterator *message_iterator, void *user_data)
User initialization function for bt_graph_add_simple_sink_component().
Definition graph.h:970
struct bt_graph bt_graph
Trace processing graph.
Definition types.h:51
bt_graph_add_component_status bt_graph_add_source_component_with_initialize_method_data(bt_graph *graph, const bt_component_class_source *component_class, const char *name, const bt_value *params, void *initialize_method_data, bt_logging_level logging_level, const bt_component_source **component)
Creates a source component from the class component_class with the initialization parameters params,...
bt_graph_connect_ports_status bt_graph_connect_ports(bt_graph *graph, const bt_port_output *upstream_port, const bt_port_input *downstream_port, const bt_connection **connection)
Connects the output port upstream_port to the input port downstream_port within the trace processing ...
bt_graph_add_component_status bt_graph_add_sink_component(bt_graph *graph, const bt_component_class_sink *component_class, const char *name, const bt_value *params, bt_logging_level logging_level, const bt_component_sink **component)
Alias of bt_graph_add_sink_component_with_initialize_method_data() with the initialize_method_data pa...
bt_graph_listener_func_status(* bt_graph_filter_component_output_port_added_listener_func)(const bt_component_filter *component, const bt_port_output *port, void *user_data)
User function for bt_graph_add_filter_component_output_port_added_listener().
Definition graph.h:1892
bt_graph_add_component_status bt_graph_add_filter_component(bt_graph *graph, const bt_component_class_filter *component_class, const char *name, const bt_value *params, bt_logging_level logging_level, const bt_component_filter **component)
Alias of bt_graph_add_filter_component_with_initialize_method_data() with the initialize_method_data ...
bt_graph_add_listener_status bt_graph_add_source_component_output_port_added_listener(bt_graph *graph, bt_graph_source_component_output_port_added_listener_func user_func, void *user_data, bt_listener_id *listener_id)
Adds a "source component output port added" listener to the trace processing graph graph.
bt_graph_listener_func_status(* bt_graph_sink_component_input_port_added_listener_func)(const bt_component_sink *component, const bt_port_input *port, void *user_data)
User function for bt_graph_add_sink_component_input_port_added_listener().
Definition graph.h:1740
void(* bt_graph_simple_sink_component_finalize_func)(void *user_data)
User finalization function for bt_graph_add_simple_sink_component().
Definition graph.h:1091
bt_graph_listener_func_status
Status codes for the bt_graph_*_component_*_port_added_listener_func() types.
Definition graph.h:1610
bt_graph_simple_sink_component_consume_func_status
Status codes for the bt_graph_simple_sink_component_consume_func type.
Definition graph.h:979
bt_graph_add_component_status bt_graph_add_simple_sink_component(bt_graph *graph, const char *name, bt_graph_simple_sink_component_initialize_func initialize_func, bt_graph_simple_sink_component_consume_func consume_func, bt_graph_simple_sink_component_finalize_func finalize_func, void *user_data, const bt_component_sink **component)
Creates a simple sink component, adds it to the trace processing graph graph with the name name,...
void bt_graph_get_ref(const bt_graph *graph)
Increments the reference count of the trace processing graph graph.
bt_graph_simple_sink_component_initialize_func_status
Status codes for the bt_graph_simple_sink_component_initialize_func type.
Definition graph.h:909
bt_graph_run_status bt_graph_run(bt_graph *graph)
Runs the trace processing graph graph, calling the consuming method of each sink component in a round...
bt_graph_run_once_status
Status codes for bt_graph_run().
Definition graph.h:1365
bt_graph_add_listener_status bt_graph_add_filter_component_output_port_added_listener(bt_graph *graph, bt_graph_filter_component_output_port_added_listener_func user_func, void *user_data, bt_listener_id *listener_id)
Adds a "filter component output port added" listener to the trace processing graph graph.
bt_graph_add_component_status bt_graph_add_filter_component_with_initialize_method_data(bt_graph *graph, const bt_component_class_filter *component_class, const char *name, const bt_value *params, void *initialize_method_data, bt_logging_level logging_level, const bt_component_filter **component)
Creates a filter component from the class component_class with the initialization parameters params,...
bt_graph_add_interrupter_status
Status codes for bt_graph_add_interrupter().
Definition graph.h:1491
bt_graph_run_once_status bt_graph_run_once(bt_graph *graph)
Calls the consuming method of the next non-ended sink component to make consume within the trace proc...
bt_interrupter * bt_graph_borrow_default_interrupter(bt_graph *graph)
Borrows the default interrupter from the trace processing graph graph.
@ BT_GRAPH_CONNECT_PORTS_STATUS_ERROR
Other error.
Definition graph.h:1185
@ BT_GRAPH_CONNECT_PORTS_STATUS_OK
Success.
Definition graph.h:1173
@ BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1179
@ BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:589
@ BT_GRAPH_ADD_COMPONENT_STATUS_ERROR
Other error.
Definition graph.h:595
@ BT_GRAPH_ADD_COMPONENT_STATUS_OK
Success.
Definition graph.h:583
@ BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1601
@ BT_GRAPH_ADD_LISTENER_STATUS_OK
Success.
Definition graph.h:1595
@ BT_GRAPH_RUN_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1274
@ BT_GRAPH_RUN_STATUS_ERROR
Other error.
Definition graph.h:1280
@ BT_GRAPH_RUN_STATUS_OK
Success.
Definition graph.h:1262
@ BT_GRAPH_RUN_STATUS_AGAIN
Try again.
Definition graph.h:1268
@ BT_GRAPH_LISTENER_FUNC_STATUS_ERROR
Other error.
Definition graph.h:1627
@ BT_GRAPH_LISTENER_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1621
@ BT_GRAPH_LISTENER_FUNC_STATUS_OK
Success.
Definition graph.h:1615
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_AGAIN
Try again.
Definition graph.h:996
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_END
End of processing.
Definition graph.h:990
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_OK
Success.
Definition graph.h:984
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1002
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_ERROR
Other error.
Definition graph.h:1008
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:920
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_OK
Success.
Definition graph.h:914
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_ERROR
Other error.
Definition graph.h:926
@ BT_GRAPH_RUN_ONCE_STATUS_END
All sink components are finished processing.
Definition graph.h:1376
@ BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1388
@ BT_GRAPH_RUN_ONCE_STATUS_ERROR
Other error.
Definition graph.h:1394
@ BT_GRAPH_RUN_ONCE_STATUS_OK
Success.
Definition graph.h:1370
@ BT_GRAPH_RUN_ONCE_STATUS_AGAIN
Try again.
Definition graph.h:1382
@ BT_GRAPH_ADD_INTERRUPTER_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1502
@ BT_GRAPH_ADD_INTERRUPTER_STATUS_OK
Success.
Definition graph.h:1496
struct bt_interrupter bt_interrupter
Interrupter.
Definition types.h:57
bt_logging_level
Logging level enumerators.
Definition logging.h:97
struct bt_message_iterator bt_message_iterator
Message iterator.
Definition types.h:59
struct bt_port_output bt_port_output
Output port.
Definition types.h:67
struct bt_port_input bt_port_input
Input port.
Definition types.h:66
struct bt_value bt_value
Value.
Definition types.h:93