17 #ifndef _FGT_GRAPH_TRACE_IMPL_H
18 #define _FGT_GRAPH_TRACE_IMPL_H
20 #include "../tbb_profiling.h"
21 #if (_MSC_VER >= 1900)
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
48 static inline void fgt_composite (
void* codeptr,
void *node,
void *graph ) {
51 #if TBB_PREVIEW_FLOW_GRAPH_TRACE
52 if (codeptr != NULL) {
58 static inline void fgt_internal_alias_input_port(
void *node,
void *
p,
string_index name_index ) {
63 static inline void fgt_internal_alias_output_port(
void *node,
void *
p,
string_index name_index ) {
68 template<
typename InputType>
71 fgt_internal_alias_input_port( node, port, name_index);
74 template <
typename PortsTuple,
int N >
75 struct fgt_internal_input_alias_helper {
76 static void alias_port(
void *node, PortsTuple &ports ) {
82 template <
typename PortsTuple >
83 struct fgt_internal_input_alias_helper<PortsTuple, 0> {
84 static void alias_port(
void * , PortsTuple & ) { }
87 template<
typename OutputType>
90 fgt_internal_alias_output_port( node,
static_cast<void *
>(port), name_index);
93 template <
typename PortsTuple,
int N >
94 struct fgt_internal_output_alias_helper {
95 static void alias_port(
void *node, PortsTuple &ports ) {
101 template <
typename PortsTuple >
102 struct fgt_internal_output_alias_helper<PortsTuple, 0> {
103 static void alias_port(
void * , PortsTuple & ) {
107 static inline void fgt_internal_create_input_port(
void *node,
void *
p,
string_index name_index ) {
111 static 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) {
121 template<
typename InputType>
127 fgt_internal_create_input_port(node,
static_cast<void*
>(port), name_index);
130 template <
typename PortsTuple,
int N >
131 struct 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 );
138 template <
typename PortsTuple >
139 struct 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 );
145 template<
typename OutputType>
148 fgt_internal_create_output_port( codeptr, node,
static_cast<void *
>(port), name_index);
151 template <
typename PortsTuple,
int N >
152 struct 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 );
159 template <
typename PortsTuple >
160 struct 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 );
166 template<
typename NodeType >
172 template<
typename NodeType >
174 void *
addr =
const_cast<NodeType *
>(node);
178 template<
typename NodeType >
179 static inline void fgt_node_desc(
const NodeType *node,
const char *desc ) {
188 static inline void fgt_body(
void *node,
void *body ) {
192 template<
int N,
typename PortsTuple >
196 fgt_internal_output_helper<PortsTuple, N>::register_port(codeptr,
input_port, ports );
199 template<
int N,
typename PortsTuple >
203 fgt_internal_output_helper<PortsTuple, N>::register_port( codeptr,
input_port, ports );
207 template<
int N,
typename PortsTuple >
211 fgt_internal_input_helper<PortsTuple, N>::register_port(
output_port, ports );
217 #if TBB_PREVIEW_FLOW_GRAPH_TRACE
218 if (codeptr != NULL) {
248 fgt_internal_create_input_port(
output_port, decrement_port, FLOW_INPUT_PORT_1 );
259 static inline void fgt_graph(
void *g ) {
295 #else // TBB_USE_THREADING_TOOLS
297 #define CODEPTR() NULL
305 template<
typename NodeType >
308 template<
typename NodeType >
315 template<
int N,
typename PortsTuple >
318 template<
int N,
typename PortsTuple >
321 template<
int N,
typename PortsTuple >
346 template<
typename NodeType >
349 template <
typename PortsTuple,
int N >
354 template <
typename PortsTuple,
int N >
359 #endif // TBB_USE_THREADING_TOOLS