Babeltrace 2 C API 2.0.7
Open-source trace manipulation framework
Loading...
Searching...
No Matches
graph.h
1#ifndef BABELTRACE2_GRAPH_GRAPH_H
2#define BABELTRACE2_GRAPH_GRAPH_H
3
4/*
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
30#include <babeltrace2/types.h>
31#include <babeltrace2/logging.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
577extern bt_graph *bt_graph_create(uint64_t mip_version);
578
610
618 const bt_component_class_source *component_class,
619 const char *name, const bt_value *params,
620 bt_logging_level logging_level,
621 const bt_component_source **component);
622
698 bt_graph *graph,
699 const bt_component_class_source *component_class,
700 const char *name, const bt_value *params,
701 void *initialize_method_data, bt_logging_level logging_level,
702 const bt_component_source **component);
703
711 const bt_component_class_filter *component_class,
712 const char *name, const bt_value *params,
713 bt_logging_level logging_level,
714 const bt_component_filter **component);
715
791 bt_graph *graph,
792 const bt_component_class_filter *component_class,
793 const char *name, const bt_value *params,
794 void *initialize_method_data, bt_logging_level logging_level,
795 const bt_component_filter **component);
796
804 bt_graph *graph, const bt_component_class_sink *component_class,
805 const char *name, const bt_value *params,
806 bt_logging_level logging_level,
807 const bt_component_sink **component);
808
884 bt_graph *graph, const bt_component_class_sink *component_class,
885 const char *name, const bt_value *params,
886 void *initialize_method_data, bt_logging_level logging_level,
887 const bt_component_sink **component);
888
920
963 bt_message_iterator *message_iterator,
964 void *user_data);
965
1002
1059 bt_message_iterator *message_iterator,
1060 void *user_data);
1061
1084typedef void (*bt_graph_simple_sink_component_finalize_func)(void *user_data);
1085
1143bt_graph_add_simple_sink_component(bt_graph *graph, const char *name,
1147 void *user_data, const bt_component_sink **component);
1148
1179
1234 const bt_port_output *upstream_port,
1235 const bt_port_input *downstream_port,
1236 const bt_connection **connection);
1237
1254 BT_GRAPH_RUN_STATUS_OK = __BT_FUNC_STATUS_OK,
1255
1260 BT_GRAPH_RUN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
1261
1266 BT_GRAPH_RUN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1267
1272 BT_GRAPH_RUN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
1274
1352extern bt_graph_run_status bt_graph_run(bt_graph *graph);
1353
1363 BT_GRAPH_RUN_ONCE_STATUS_OK = __BT_FUNC_STATUS_OK,
1364
1369 BT_GRAPH_RUN_ONCE_STATUS_END = __BT_FUNC_STATUS_END,
1370
1375 BT_GRAPH_RUN_ONCE_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
1376
1381 BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1382
1387 BT_GRAPH_RUN_ONCE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
1389
1472
1497
1545 const bt_interrupter *interrupter);
1546
1567extern bt_interrupter *bt_graph_borrow_default_interrupter(bt_graph *graph);
1568
1595
1621
1657 const bt_component_filter *component,
1658 const bt_port_input *port, void *user_data);
1659
1694 bt_graph *graph,
1696 void *user_data, bt_listener_id *listener_id);
1697
1733 const bt_component_sink *component,
1734 const bt_port_input *port, void *user_data);
1735
1770 bt_graph *graph,
1772 void *user_data, bt_listener_id *listener_id);
1773
1809 const bt_component_source *component,
1810 const bt_port_output *port, void *user_data);
1811
1846 bt_graph *graph,
1848 void *user_data, bt_listener_id *listener_id);
1849
1885 const bt_component_filter *component,
1886 const bt_port_output *port, void *user_data);
1887
1922 bt_graph *graph,
1924 void *user_data, bt_listener_id *listener_id);
1925
1948extern void bt_graph_get_ref(const bt_graph *graph);
1949
1965extern void bt_graph_put_ref(const bt_graph *graph);
1966
1981#define BT_GRAPH_PUT_REF_AND_RESET(_graph) \
1982 do { \
1983 bt_graph_put_ref(_graph); \
1984 (_graph) = NULL; \
1985 } while (0)
1986
2013#define BT_GRAPH_MOVE_REF(_dst, _src) \
2014 do { \
2015 bt_graph_put_ref(_dst); \
2016 (_dst) = (_src); \
2017 (_src) = NULL; \
2018 } while (0)
2019
2024#ifdef __cplusplus
2025}
2026#endif
2027
2028#endif /* BABELTRACE2_GRAPH_GRAPH_H */
uint64_t bt_listener_id
Numeric ID which identifies a user listener function.
Definition types.h:150
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:1656
bt_graph_connect_ports_status
Status codes for bt_graph_connect_ports().
Definition graph.h:1160
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:1808
bt_graph_add_component_status
Status codes for the bt_graph_add_*_component*() functions.
Definition graph.h:591
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:1058
bt_graph_add_listener_status
Status codes for the bt_graph_add_*_component_*_port_added_listener() functions.
Definition graph.h:1582
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:1249
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:962
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:1884
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:1732
void(* bt_graph_simple_sink_component_finalize_func)(void *user_data)
User finalization function for bt_graph_add_simple_sink_component().
Definition graph.h:1084
bt_graph_listener_func_status
Status codes for the bt_graph_*_component_*_port_added_listener_func() types.
Definition graph.h:1602
bt_graph_simple_sink_component_consume_func_status
Status codes for the bt_graph_simple_sink_component_consume_func type.
Definition graph.h:971
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:901
bt_graph_run_status bt_graph_run(bt_graph *graph)
Runs the trace processing graph graph, calling each sink component's consuming method in a round robi...
bt_graph_run_once_status
Status codes for bt_graph_run().
Definition graph.h:1358
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:1484
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:1177
@ BT_GRAPH_CONNECT_PORTS_STATUS_OK
Success.
Definition graph.h:1165
@ BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1171
@ BT_GRAPH_ADD_COMPONENT_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:602
@ BT_GRAPH_ADD_COMPONENT_STATUS_ERROR
Other error.
Definition graph.h:608
@ BT_GRAPH_ADD_COMPONENT_STATUS_OK
Success.
Definition graph.h:596
@ BT_GRAPH_ADD_LISTENER_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1593
@ BT_GRAPH_ADD_LISTENER_STATUS_OK
Success.
Definition graph.h:1587
@ BT_GRAPH_RUN_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1266
@ BT_GRAPH_RUN_STATUS_ERROR
Other error.
Definition graph.h:1272
@ BT_GRAPH_RUN_STATUS_OK
Success.
Definition graph.h:1254
@ BT_GRAPH_RUN_STATUS_AGAIN
Try again.
Definition graph.h:1260
@ BT_GRAPH_LISTENER_FUNC_STATUS_ERROR
Other error.
Definition graph.h:1619
@ BT_GRAPH_LISTENER_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1613
@ BT_GRAPH_LISTENER_FUNC_STATUS_OK
Success.
Definition graph.h:1607
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_AGAIN
Try again.
Definition graph.h:988
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_END
End of processing.
Definition graph.h:982
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_OK
Success.
Definition graph.h:976
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:994
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_CONSUME_FUNC_STATUS_ERROR
Other error.
Definition graph.h:1000
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:912
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_OK
Success.
Definition graph.h:906
@ BT_GRAPH_SIMPLE_SINK_COMPONENT_INITIALIZE_FUNC_STATUS_ERROR
Other error.
Definition graph.h:918
@ BT_GRAPH_RUN_ONCE_STATUS_END
All sink components are finished processing.
Definition graph.h:1369
@ BT_GRAPH_RUN_ONCE_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1381
@ BT_GRAPH_RUN_ONCE_STATUS_ERROR
Other error.
Definition graph.h:1387
@ BT_GRAPH_RUN_ONCE_STATUS_OK
Success.
Definition graph.h:1363
@ BT_GRAPH_RUN_ONCE_STATUS_AGAIN
Try again.
Definition graph.h:1375
@ BT_GRAPH_ADD_INTERRUPTER_STATUS_MEMORY_ERROR
Out of memory.
Definition graph.h:1495
@ BT_GRAPH_ADD_INTERRUPTER_STATUS_OK
Success.
Definition graph.h:1489
bt_logging_level
Logging level enumerators.
Definition logging.h:110