21 #ifndef _FGT_GRAPH_TRACE_IMPL_H 22 #define _FGT_GRAPH_TRACE_IMPL_H 24 #include "../tbb_profiling.h" 29 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 31 static inline void fgt_internal_create_input_port(
void *node,
void *p, string_index name_index ) {
32 itt_make_task_group( ITT_DOMAIN_FLOW, p, FLOW_INPUT_PORT, node, FLOW_NODE, name_index );
35 static inline void fgt_internal_create_output_port(
void *node,
void *p, string_index name_index ) {
36 itt_make_task_group( ITT_DOMAIN_FLOW, p, FLOW_OUTPUT_PORT, node, FLOW_NODE, name_index );
39 template<
typename InputType>
42 fgt_internal_create_input_port( node, port, name_index);
45 template <
typename PortsTuple,
int N >
46 struct fgt_internal_input_helper {
47 static void register_port(
void *node, PortsTuple &ports ) {
48 register_input_port( node, &(tbb::flow::get<N-1>(ports)), static_cast<tbb::internal::string_index>(FLOW_INPUT_PORT_0 + N - 1) );
49 fgt_internal_input_helper<PortsTuple, N-1>::register_port( node, ports );
53 template <
typename PortsTuple >
54 struct fgt_internal_input_helper<PortsTuple, 1> {
55 static void register_port(
void *node, PortsTuple &ports ) {
56 register_input_port( node, &(tbb::flow::get<0>(ports)), FLOW_INPUT_PORT_0 );
60 template<
typename OutputType>
63 fgt_internal_create_output_port( node, static_cast<void *>(port), name_index);
66 template <
typename PortsTuple,
int N >
67 struct fgt_internal_output_helper {
68 static void register_port(
void *node, PortsTuple &ports ) {
69 register_output_port( node, &(tbb::flow::get<N-1>(ports)), static_cast<tbb::internal::string_index>(FLOW_OUTPUT_PORT_0 + N - 1) );
70 fgt_internal_output_helper<PortsTuple, N-1>::register_port( node, ports );
74 template <
typename PortsTuple >
75 struct fgt_internal_output_helper<PortsTuple,1> {
76 static void register_port(
void *node, PortsTuple &ports ) {
77 register_output_port( node, &(tbb::flow::get<0>(ports)), FLOW_OUTPUT_PORT_0 );
81 template<
typename NodeType >
82 void fgt_multioutput_node_desc(
const NodeType *node,
const char *desc ) {
84 itt_metadata_str_add( ITT_DOMAIN_FLOW, addr, FLOW_NODE, FLOW_OBJECT_NAME, desc );
87 template<
typename NodeType >
88 void fgt_multiinput_multioutput_node_desc(
const NodeType *node,
const char *desc ) {
89 void *addr =
const_cast<NodeType *
>(node);
90 itt_metadata_str_add( ITT_DOMAIN_FLOW, addr, FLOW_NODE, FLOW_OBJECT_NAME, desc );
93 template<
typename NodeType >
94 static inline void fgt_node_desc(
const NodeType *node,
const char *desc ) {
96 itt_metadata_str_add( ITT_DOMAIN_FLOW, addr, FLOW_NODE, FLOW_OBJECT_NAME, desc );
99 static inline void fgt_graph_desc(
void *g,
const char *desc ) {
100 itt_metadata_str_add( ITT_DOMAIN_FLOW, g, FLOW_GRAPH, FLOW_OBJECT_NAME, desc );
103 static inline void fgt_body(
void *node,
void *body ) {
104 itt_relation_add( ITT_DOMAIN_FLOW, body, FLOW_BODY, __itt_relation_is_child_of, node, FLOW_NODE );
107 template<
int N,
typename PortsTuple >
108 static inline void fgt_multioutput_node( string_index t,
void *g,
void *input_port, PortsTuple &ports ) {
109 itt_make_task_group( ITT_DOMAIN_FLOW, input_port, FLOW_NODE, g, FLOW_GRAPH, t );
110 fgt_internal_create_input_port( input_port, input_port, FLOW_INPUT_PORT_0 );
111 fgt_internal_output_helper<PortsTuple, N>::register_port( input_port, ports );
114 template<
int N,
typename PortsTuple >
115 static inline void fgt_multioutput_node_with_body( string_index t,
void *g,
void *input_port, PortsTuple &ports,
void *body ) {
116 itt_make_task_group( ITT_DOMAIN_FLOW, input_port, FLOW_NODE, g, FLOW_GRAPH, t );
117 fgt_internal_create_input_port( input_port, input_port, FLOW_INPUT_PORT_0 );
118 fgt_internal_output_helper<PortsTuple, N>::register_port( input_port, ports );
119 fgt_body( input_port, body );
122 template<
int N,
typename PortsTuple >
123 static inline void fgt_multiinput_node( string_index t,
void *g, PortsTuple &ports,
void *output_port) {
124 itt_make_task_group( ITT_DOMAIN_FLOW, output_port, FLOW_NODE, g, FLOW_GRAPH, t );
125 fgt_internal_create_output_port( output_port, output_port, FLOW_OUTPUT_PORT_0 );
126 fgt_internal_input_helper<PortsTuple, N>::register_port( output_port, ports );
129 static inline void fgt_node( string_index t,
void *g,
void *output_port ) {
130 itt_make_task_group( ITT_DOMAIN_FLOW, output_port, FLOW_NODE, g, FLOW_GRAPH, t );
131 fgt_internal_create_output_port( output_port, output_port, FLOW_OUTPUT_PORT_0 );
134 static inline void fgt_node_with_body( string_index t,
void *g,
void *output_port,
void *body ) {
135 itt_make_task_group( ITT_DOMAIN_FLOW, output_port, FLOW_NODE, g, FLOW_GRAPH, t );
136 fgt_internal_create_output_port( output_port, output_port, FLOW_OUTPUT_PORT_0 );
137 fgt_body( output_port, body );
141 static inline void fgt_node( string_index t,
void *g,
void *input_port,
void *output_port ) {
142 fgt_node( t, g, output_port );
143 fgt_internal_create_input_port( output_port, input_port, FLOW_INPUT_PORT_0 );
146 static inline void fgt_node_with_body( string_index t,
void *g,
void *input_port,
void *output_port,
void *body ) {
147 fgt_node_with_body( t, g, output_port, body );
148 fgt_internal_create_input_port( output_port, input_port, FLOW_INPUT_PORT_0 );
152 static inline void fgt_node( string_index t,
void *g,
void *input_port,
void *decrement_port,
void *output_port ) {
153 fgt_node( t, g, input_port, output_port );
154 fgt_internal_create_input_port( output_port, decrement_port, FLOW_INPUT_PORT_1 );
157 static inline void fgt_make_edge(
void *output_port,
void *input_port ) {
158 itt_relation_add( ITT_DOMAIN_FLOW, output_port, FLOW_OUTPUT_PORT, __itt_relation_is_predecessor_to, input_port, FLOW_INPUT_PORT);
161 static inline void fgt_remove_edge(
void *output_port,
void *input_port ) {
162 itt_relation_add( ITT_DOMAIN_FLOW, output_port, FLOW_OUTPUT_PORT, __itt_relation_is_sibling_of, input_port, FLOW_INPUT_PORT);
165 static inline void fgt_graph(
void *g ) {
166 itt_make_task_group( ITT_DOMAIN_FLOW, g, FLOW_GRAPH, NULL, FLOW_NULL, FLOW_GRAPH );
169 static inline void fgt_begin_body(
void *body ) {
170 itt_task_begin( ITT_DOMAIN_FLOW, body, FLOW_BODY, NULL, FLOW_NULL, FLOW_BODY );
173 static inline void fgt_end_body(
void * ) {
174 itt_task_end( ITT_DOMAIN_FLOW );
177 static inline void fgt_async_try_put_begin(
void *node,
void *port ) {
178 itt_task_begin( ITT_DOMAIN_FLOW, port, FLOW_OUTPUT_PORT, node, FLOW_NODE, FLOW_OUTPUT_PORT );
181 static inline void fgt_async_try_put_end(
void *,
void * ) {
182 itt_task_end( ITT_DOMAIN_FLOW );
185 static inline void fgt_async_reserve(
void *node,
void *graph ) {
186 itt_region_begin( ITT_DOMAIN_FLOW, node, FLOW_NODE, graph, FLOW_GRAPH, FLOW_NULL );
189 static inline void fgt_async_commit(
void *node,
void *graph ) {
190 itt_region_end( ITT_DOMAIN_FLOW, node, FLOW_NODE );
193 #else // TBB_PREVIEW_FLOW_GRAPH_TRACE 195 static inline void fgt_graph(
void * ) { }
197 template<
typename NodeType >
198 static inline void fgt_multioutput_node_desc(
const NodeType * ,
const char * ) { }
200 template<
typename NodeType >
201 static inline void fgt_node_desc(
const NodeType * ,
const char * ) { }
203 static inline void fgt_graph_desc(
void * ,
const char * ) { }
205 static inline void fgt_body(
void * ,
void * ) { }
207 template<
int N,
typename PortsTuple >
208 static inline void fgt_multioutput_node( string_index ,
void * ,
void * , PortsTuple & ) { }
210 template<
int N,
typename PortsTuple >
211 static inline void fgt_multioutput_node_with_body( string_index ,
void * ,
void * , PortsTuple & ,
void * ) { }
213 template<
int N,
typename PortsTuple >
214 static inline void fgt_multiinput_node( string_index ,
void * , PortsTuple & ,
void * ) { }
216 static inline void fgt_node( string_index ,
void * ,
void * ) { }
217 static inline void fgt_node( string_index ,
void * ,
void * ,
void * ) { }
218 static inline void fgt_node( string_index ,
void * ,
void * ,
void * ,
void * ) { }
220 static inline void fgt_node_with_body( string_index ,
void * ,
void * ,
void * ) { }
221 static inline void fgt_node_with_body( string_index ,
void * ,
void * ,
void * ,
void * ) { }
223 static inline void fgt_make_edge(
void * ,
void * ) { }
224 static inline void fgt_remove_edge(
void * ,
void * ) { }
226 static inline void fgt_begin_body(
void * ) { }
227 static inline void fgt_end_body(
void * ) { }
228 static inline void fgt_async_try_put_begin(
void * ,
void * ) { }
229 static inline void fgt_async_try_put_end(
void * ,
void * ) { }
230 static inline void fgt_async_reserve(
void * ,
void * ) { }
231 static inline void fgt_async_commit(
void * ,
void * ) { }
233 #endif // TBB_PREVIEW_FLOW_GRAPH_TRACE Pure virtual template class that defines a receiver of messages of type T.
Definition: flow_graph.h:103
Definition: _flow_graph_async_msg_impl.h:32
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44
Pure virtual template class that defines a sender of messages of type T.
Definition: flow_graph.h:102