21 #ifndef __TBB_profiling_H 22 #define __TBB_profiling_H 32 #define TBB_STRING_RESOURCE(index_name,str) index_name, 34 #include "internal/_tbb_strings.h" 37 #undef TBB_STRING_RESOURCE 41 __itt_relation_is_unknown = 0,
42 __itt_relation_is_dependent_on,
43 __itt_relation_is_sibling_of,
44 __itt_relation_is_parent_of,
45 __itt_relation_is_continuation_of,
46 __itt_relation_is_child_of,
47 __itt_relation_is_continued_by,
48 __itt_relation_is_predecessor_to
55 #if (_WIN32||_WIN64||__linux__) && !__MINGW32__ && TBB_USE_THREADING_TOOLS 60 #include "tbb_stddef.h" 66 void __TBB_EXPORTED_FUNC itt_set_sync_name_v3(
void *obj,
const wchar_t* name );
67 inline size_t multibyte_to_widechar(
wchar_t* wcs,
const char* mbs,
size_t bufsize) {
70 mbstowcs_s( &len, wcs, bufsize, mbs, _TRUNCATE );
73 size_t len = mbstowcs( wcs, mbs, bufsize );
74 if(wcs && len!=
size_t(-1) )
75 wcs[len<bufsize-1? len: bufsize-1] = wchar_t(
'\0');
80 void __TBB_EXPORTED_FUNC itt_set_sync_name_v3(
void *obj,
const char* name );
89 #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type) \ 90 namespace profiling { \ 91 inline void set_name( sync_object_type& obj, const wchar_t* name ) { \ 92 tbb::internal::itt_set_sync_name_v3( &obj, name ); \ 94 inline void set_name( sync_object_type& obj, const char* name ) { \ 95 size_t len = tbb::internal::multibyte_to_widechar(NULL, name, 0); \ 96 wchar_t *wname = new wchar_t[len]; \ 97 tbb::internal::multibyte_to_widechar(wname, name, len); \ 98 set_name( obj, wname ); \ 103 #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type) \ 104 namespace profiling { \ 105 inline void set_name( sync_object_type& obj, const char* name ) { \ 106 tbb::internal::itt_set_sync_name_v3( &obj, name ); \ 114 #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type) \ 115 namespace profiling { \ 116 inline void set_name( sync_object_type&, const wchar_t* ) {} \ 117 inline void set_name( sync_object_type&, const char* ) {} \ 120 #define __TBB_DEFINE_PROFILING_SET_NAME(sync_object_type) \ 121 namespace profiling { \ 122 inline void set_name( sync_object_type&, const char* ) {} \ 133 enum notify_type {prepare=0, cancel, acquired, releasing};
135 const uintptr_t NUM_NOTIFY_TYPES = 4;
137 void __TBB_EXPORTED_FUNC call_itt_notify_v5(
int t,
void *ptr);
138 void __TBB_EXPORTED_FUNC itt_store_pointer_with_release_v3(
void *dst,
void *src);
139 void* __TBB_EXPORTED_FUNC itt_load_pointer_with_acquire_v3(
const void *src);
140 void* __TBB_EXPORTED_FUNC itt_load_pointer_v3(
const void* src );
141 #if __TBB_ITT_STRUCTURE_API 142 enum itt_domain_enum { ITT_DOMAIN_FLOW=0 };
144 void __TBB_EXPORTED_FUNC itt_make_task_group_v7( itt_domain_enum domain,
void *group,
unsigned long long group_extra,
145 void *parent,
unsigned long long parent_extra, string_index name_index );
146 void __TBB_EXPORTED_FUNC itt_metadata_str_add_v7( itt_domain_enum domain,
void *addr,
unsigned long long addr_extra,
147 string_index key,
const char *value );
148 void __TBB_EXPORTED_FUNC itt_relation_add_v7( itt_domain_enum domain,
void *addr0,
unsigned long long addr0_extra,
149 itt_relation relation,
void *addr1,
unsigned long long addr1_extra );
150 void __TBB_EXPORTED_FUNC itt_task_begin_v7( itt_domain_enum domain,
void *task,
unsigned long long task_extra,
151 void *parent,
unsigned long long parent_extra, string_index name_index );
152 void __TBB_EXPORTED_FUNC itt_task_end_v7( itt_domain_enum domain );
154 void __TBB_EXPORTED_FUNC itt_region_begin_v9( itt_domain_enum domain,
void *region,
unsigned long long region_extra,
155 void *parent,
unsigned long long parent_extra, string_index name_index );
156 void __TBB_EXPORTED_FUNC itt_region_end_v9( itt_domain_enum domain,
void *region,
unsigned long long region_extra );
157 #endif // __TBB_ITT_STRUCTURE_API 160 template <
typename T,
typename U>
161 inline void itt_store_word_with_release(
tbb::atomic<T>& dst, U src) {
162 #if TBB_USE_THREADING_TOOLS 164 __TBB_ASSERT(
sizeof(T) ==
sizeof(
void *),
"Type must be word-sized.");
165 itt_store_pointer_with_release_v3(&dst, (
void *)uintptr_t(src));
168 #endif // TBB_USE_THREADING_TOOLS 171 template <
typename T>
173 #if TBB_USE_THREADING_TOOLS 175 __TBB_ASSERT(
sizeof(T) ==
sizeof(
void *),
"Type must be word-sized.");
176 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 178 #pragma warning (push) 179 #pragma warning (disable: 4311) 181 T result = (T)itt_load_pointer_with_acquire_v3(&src);
182 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) 183 #pragma warning (pop) 188 #endif // TBB_USE_THREADING_TOOLS 191 template <
typename T>
192 inline void itt_store_word_with_release(T& dst, T src) {
193 #if TBB_USE_THREADING_TOOLS 195 __TBB_ASSERT(
sizeof(T) ==
sizeof(
void *),
"Type must be word-sized.");
196 itt_store_pointer_with_release_v3(&dst, (
void *)src);
198 __TBB_store_with_release(dst, src);
199 #endif // TBB_USE_THREADING_TOOLS 202 template <
typename T>
203 inline T itt_load_word_with_acquire(
const T& src) {
204 #if TBB_USE_THREADING_TOOLS 206 __TBB_ASSERT(
sizeof(T) ==
sizeof(
void *),
"Type must be word-sized");
207 return (T)itt_load_pointer_with_acquire_v3(&src);
209 return __TBB_load_with_acquire(src);
210 #endif // TBB_USE_THREADING_TOOLS 213 template <
typename T>
214 inline void itt_hide_store_word(T& dst, T src) {
215 #if TBB_USE_THREADING_TOOLS 217 __TBB_ASSERT(
sizeof(T) ==
sizeof(
void *),
"Type must be word-sized");
218 itt_store_pointer_with_release_v3(&dst, (
void *)src);
225 template <
typename T>
226 inline T itt_hide_load_word(
const T& src) {
227 #if TBB_USE_THREADING_TOOLS 229 __TBB_ASSERT(
sizeof(T) ==
sizeof(
void *),
"Type must be word-sized.");
230 return (T)itt_load_pointer_v3(&src);
236 #if TBB_USE_THREADING_TOOLS 237 inline void call_itt_notify(notify_type t,
void *ptr) {
238 call_itt_notify_v5((
int)t, ptr);
242 inline void call_itt_notify(notify_type ,
void * ) {}
244 #endif // TBB_USE_THREADING_TOOLS 246 #if __TBB_ITT_STRUCTURE_API 247 inline void itt_make_task_group( itt_domain_enum domain,
void *group,
unsigned long long group_extra,
248 void *parent,
unsigned long long parent_extra, string_index name_index ) {
249 itt_make_task_group_v7( domain, group, group_extra, parent, parent_extra, name_index );
252 inline void itt_metadata_str_add( itt_domain_enum domain,
void *addr,
unsigned long long addr_extra,
253 string_index key,
const char *value ) {
254 itt_metadata_str_add_v7( domain, addr, addr_extra, key, value );
257 inline void itt_relation_add( itt_domain_enum domain,
void *addr0,
unsigned long long addr0_extra,
258 itt_relation relation,
void *addr1,
unsigned long long addr1_extra ) {
259 itt_relation_add_v7( domain, addr0, addr0_extra, relation, addr1, addr1_extra );
262 inline void itt_task_begin( itt_domain_enum domain,
void *task,
unsigned long long task_extra,
263 void *parent,
unsigned long long parent_extra, string_index name_index ) {
264 itt_task_begin_v7( domain, task, task_extra, parent, parent_extra, name_index );
267 inline void itt_task_end( itt_domain_enum domain ) {
268 itt_task_end_v7( domain );
271 inline void itt_region_begin( itt_domain_enum domain,
void *region,
unsigned long long region_extra,
272 void *parent,
unsigned long long parent_extra, string_index name_index ) {
273 itt_region_begin_v9( domain, region, region_extra, parent, parent_extra, name_index );
276 inline void itt_region_end( itt_domain_enum domain,
void *region,
unsigned long long region_extra ) {
277 itt_region_end_v9( domain, region, region_extra );
279 #endif // __TBB_ITT_STRUCTURE_API Primary template for atomic.
Definition: atomic.h:405
Definition: _flow_graph_async_msg_impl.h:32
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44