17#ifndef _FGT_GRAPH_TRACE_IMPL_H
18#define _FGT_GRAPH_TRACE_IMPL_H
20#include "../tbb_profiling.h"
28#if TBB_USE_THREADING_TOOLS
29 #if TBB_PREVIEW_FLOW_GRAPH_TRACE
30 #if (_MSC_VER >= 1900)
31 #define CODEPTR() (_ReturnAddress())
32 #elif __TBB_GCC_VERSION >= 40800
33 #define CODEPTR() ( __builtin_return_address(0))
35 #define CODEPTR() NULL
38 #define CODEPTR() NULL
48static inline void fgt_composite (
void* codeptr,
void *node,
void *graph ) {
51#if TBB_PREVIEW_FLOW_GRAPH_TRACE
52 if (codeptr != NULL) {
58static inline void fgt_internal_alias_input_port(
void *node,
void *
p,
string_index name_index ) {
63static inline void fgt_internal_alias_output_port(
void *node,
void *
p,
string_index name_index ) {
68template<
typename InputType>
71 fgt_internal_alias_input_port( node, port, name_index);
74template <
typename PortsTuple,
int N >
75struct fgt_internal_input_alias_helper {
76 static void alias_port(
void *node, PortsTuple &ports ) {
82template <
typename PortsTuple >
83struct fgt_internal_input_alias_helper<PortsTuple, 0> {
84 static void alias_port(
void * , PortsTuple & ) { }
87template<
typename OutputType>
90 fgt_internal_alias_output_port( node,
static_cast<void *
>(port), name_index);
93template <
typename PortsTuple,
int N >
94struct fgt_internal_output_alias_helper {
95 static void alias_port(
void *node, PortsTuple &ports ) {
101template <
typename PortsTuple >
102struct fgt_internal_output_alias_helper<PortsTuple, 0> {
103 static void alias_port(
void * , PortsTuple & ) {
107static inline void fgt_internal_create_input_port(
void *node,
void *
p,
string_index name_index ) {
111static inline void fgt_internal_create_output_port(
void* codeptr,
void *node,
void *
p,
string_index name_index ) {
114#if TBB_PREVIEW_FLOW_GRAPH_TRACE
115 if (codeptr != NULL) {
121template<
typename InputType>
127 fgt_internal_create_input_port(node,
static_cast<void*
>(port), name_index);
130template <
typename PortsTuple,
int N >
131struct fgt_internal_input_helper {
132 static void register_port(
void *node, PortsTuple &ports ) {
134 fgt_internal_input_helper<PortsTuple, N-1>::register_port( node, ports );
138template <
typename PortsTuple >
139struct fgt_internal_input_helper<PortsTuple, 1> {
140 static void register_port(
void *node, PortsTuple &ports ) {
141 register_input_port( node, &(tbb::flow::get<0>(ports)), FLOW_INPUT_PORT_0 );
145template<
typename OutputType>
148 fgt_internal_create_output_port( codeptr, node,
static_cast<void *
>(port), name_index);
151template <
typename PortsTuple,
int N >
152struct fgt_internal_output_helper {
153 static void register_port(
void* codeptr,
void *node, PortsTuple &ports ) {
154 register_output_port( codeptr, node, &(tbb::flow::get<N-1>(ports)),
static_cast<tbb::internal::string_index>(FLOW_OUTPUT_PORT_0 + N - 1) );
155 fgt_internal_output_helper<PortsTuple, N-1>::register_port( codeptr, node, ports );
159template <
typename PortsTuple >
160struct fgt_internal_output_helper<PortsTuple,1> {
161 static void register_port(
void* codeptr,
void *node, PortsTuple &ports ) {
162 register_output_port( codeptr, node, &(tbb::flow::get<0>(ports)), FLOW_OUTPUT_PORT_0 );
166template<
typename NodeType >
172template<
typename NodeType >
174 void *
addr =
const_cast<NodeType *
>(node);
178template<
typename NodeType >
179static inline void fgt_node_desc(
const NodeType *node,
const char *desc ) {
188static inline void fgt_body(
void *node,
void *body ) {
192template<
int N,
typename PortsTuple >
195 fgt_internal_create_input_port( input_port, input_port, FLOW_INPUT_PORT_0 );
196 fgt_internal_output_helper<PortsTuple, N>::register_port(codeptr, input_port, ports );
199template<
int N,
typename PortsTuple >
202 fgt_internal_create_input_port( input_port, input_port, FLOW_INPUT_PORT_0 );
203 fgt_internal_output_helper<PortsTuple, N>::register_port( codeptr, input_port, ports );
207template<
int N,
typename PortsTuple >
210 fgt_internal_create_output_port( codeptr, output_port, output_port, FLOW_OUTPUT_PORT_0 );
211 fgt_internal_input_helper<PortsTuple, N>::register_port( output_port, ports );
217#if TBB_PREVIEW_FLOW_GRAPH_TRACE
218 if (codeptr != NULL) {
226 fgt_internal_create_output_port( codeptr, output_port, output_port, FLOW_OUTPUT_PORT_0 );
231 fgt_internal_create_output_port(codeptr, output_port, output_port, FLOW_OUTPUT_PORT_0 );
235static inline void fgt_node(
void* codeptr,
string_index t,
void *g,
void *input_port,
void *output_port ) {
236 fgt_node( codeptr, t, g, output_port );
237 fgt_internal_create_input_port( output_port, input_port, FLOW_INPUT_PORT_0 );
242 fgt_internal_create_input_port( output_port, input_port, FLOW_INPUT_PORT_0 );
246static inline void fgt_node(
void* codeptr,
string_index t,
void *g,
void *input_port,
void *decrement_port,
void *output_port ) {
247 fgt_node( codeptr, t, g, input_port, output_port );
248 fgt_internal_create_input_port( output_port, decrement_port, FLOW_INPUT_PORT_1 );
251static inline void fgt_make_edge(
void *output_port,
void *input_port ) {
255static inline void fgt_remove_edge(
void *output_port,
void *input_port ) {
297#define CODEPTR() NULL
305template<
typename NodeType >
308template<
typename NodeType >
315template<
int N,
typename PortsTuple >
318template<
int N,
typename PortsTuple >
321template<
int N,
typename PortsTuple >
346template<
typename NodeType >
349template <
typename PortsTuple,
int N >
354template <
typename PortsTuple,
int N >
void const char const char int ITT_FORMAT __itt_group_sync p
static void fgt_async_try_put_end(void *, void *)
void itt_task_end(itt_domain_enum)
void itt_task_begin(itt_domain_enum, void *, unsigned long long, void *, unsigned long long, string_index)
void register_node_addr(itt_domain_enum, void *, unsigned long long, string_index, void *)
static void fgt_async_reserve(void *, void *)
void itt_region_end(itt_domain_enum, void *, unsigned long long)
static void fgt_multioutput_node_desc(const NodeType *, const char *)
static void fgt_async_try_put_begin(void *, void *)
static void fgt_begin_body(void *)
@ __itt_relation_is_predecessor_to
@ __itt_relation_is_parent_of
@ __itt_relation_is_sibling_of
@ __itt_relation_is_child_of
static void fgt_body(void *, void *)
static void fgt_node(void *, string_index, void *, void *)
static void fgt_reserve_wait(void *)
void suppress_unused_warning(const T1 &)
Utility template function to prevent "unused" warnings by various compilers.
static void fgt_graph(void *)
void itt_metadata_str_add(itt_domain_enum, void *, unsigned long long, string_index, const char *)
static void fgt_node_with_body(void *, string_index, void *, void *, void *)
static void fgt_multiinput_node(void *, string_index, void *, PortsTuple &, void *)
static void fgt_release_wait(void *)
static void fgt_async_commit(void *, void *)
static void fgt_composite(void *, void *, void *)
static void fgt_multioutput_node_with_body(void *, string_index, void *, void *, PortsTuple &, void *)
static void fgt_alias_port(void *, void *, bool)
void itt_relation_add(itt_domain_enum, void *, unsigned long long, itt_relation, void *, unsigned long long)
void itt_make_task_group(itt_domain_enum, void *, unsigned long long, void *, unsigned long long, string_index)
void fgt_multiinput_multioutput_node_desc(const NodeType *, const char *)
static void fgt_multiinput_multioutput_node(void *, string_index, void *, void *)
static void fgt_remove_edge(void *, void *)
static void fgt_end_body(void *)
static void fgt_node_desc(const NodeType *, const char *)
static void fgt_multioutput_node(void *, string_index, void *, void *, PortsTuple &)
static void fgt_make_edge(void *, void *)
void itt_region_begin(itt_domain_enum, void *, unsigned long long, void *, unsigned long long, string_index)
static void fgt_graph_desc(void *, const char *)
Forward declaration section.
Pure virtual template class that defines a receiver of messages of type T.
static void alias_port(void *, PortsTuple &)
static void alias_port(void *, PortsTuple &)