17 #ifndef _ITTNOTIFY_CONFIG_H_
18 #define _ITTNOTIFY_CONFIG_H_
26 # define ITT_OS_LINUX 2
33 #ifndef ITT_OS_FREEBSD
34 # define ITT_OS_FREEBSD 4
38 # if defined WIN32 || defined _WIN32
39 # define ITT_OS ITT_OS_WIN
40 # elif defined( __APPLE__ ) && defined( __MACH__ )
41 # define ITT_OS ITT_OS_MAC
42 # elif defined( __FreeBSD__ )
43 # define ITT_OS ITT_OS_FREEBSD
45 # define ITT_OS ITT_OS_LINUX
49 #ifndef ITT_PLATFORM_WIN
50 # define ITT_PLATFORM_WIN 1
53 #ifndef ITT_PLATFORM_POSIX
54 # define ITT_PLATFORM_POSIX 2
57 #ifndef ITT_PLATFORM_MAC
58 # define ITT_PLATFORM_MAC 3
61 #ifndef ITT_PLATFORM_FREEBSD
62 # define ITT_PLATFORM_FREEBSD 4
66 # if ITT_OS==ITT_OS_WIN
67 # define ITT_PLATFORM ITT_PLATFORM_WIN
68 # elif ITT_OS==ITT_OS_MAC
69 # define ITT_PLATFORM ITT_PLATFORM_MAC
70 # elif ITT_OS==ITT_OS_FREEBSD
71 # define ITT_PLATFORM ITT_PLATFORM_FREEBSD
73 # define ITT_PLATFORM ITT_PLATFORM_POSIX
77 #if defined(_UNICODE) && !defined(UNICODE)
82 #if ITT_PLATFORM==ITT_PLATFORM_WIN
86 #if defined(UNICODE) || defined(_UNICODE)
92 # if ITT_PLATFORM==ITT_PLATFORM_WIN
93 # define ITTAPI_CDECL __cdecl
95 # if defined _M_IX86 || defined __i386__
96 # define ITTAPI_CDECL __attribute__ ((cdecl))
104 # if ITT_PLATFORM==ITT_PLATFORM_WIN
105 # define STDCALL __stdcall
107 # if defined _M_IX86 || defined __i386__
108 # define STDCALL __attribute__ ((stdcall))
115 #define ITTAPI ITTAPI_CDECL
116 #define LIBITTAPI ITTAPI_CDECL
119 #define ITTAPI_CALL ITTAPI_CDECL
120 #define LIBITTAPI_CALL ITTAPI_CDECL
122 #if ITT_PLATFORM==ITT_PLATFORM_WIN
124 #define ITT_INLINE __forceinline
125 #define ITT_INLINE_ATTRIBUTE
132 #ifdef __STRICT_ANSI__
133 #define ITT_INLINE static
134 #define ITT_INLINE_ATTRIBUTE __attribute__((unused))
136 #define ITT_INLINE static inline
137 #define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
142 #ifndef ITT_ARCH_IA32
143 # define ITT_ARCH_IA32 1
146 #ifndef ITT_ARCH_IA32E
147 # define ITT_ARCH_IA32E 2
151 # define ITT_ARCH_ARM 4
154 #ifndef ITT_ARCH_PPC64
155 # define ITT_ARCH_PPC64 5
159 # if defined _M_IX86 || defined __i386__
160 # define ITT_ARCH ITT_ARCH_IA32
161 # elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
162 # define ITT_ARCH ITT_ARCH_IA32E
163 # elif defined _M_IA64 || defined __ia64__
164 # define ITT_ARCH ITT_ARCH_IA64
165 # elif defined _M_ARM || defined __arm__
166 # define ITT_ARCH ITT_ARCH_ARM
167 # elif defined __powerpc64__
168 # define ITT_ARCH ITT_ARCH_PPC64
173 # define ITT_EXTERN_C extern "C"
174 # define ITT_EXTERN_C_BEGIN extern "C" {
175 # define ITT_EXTERN_C_END }
177 # define ITT_EXTERN_C
178 # define ITT_EXTERN_C_BEGIN
179 # define ITT_EXTERN_C_END
182 #define ITT_TO_STR_AUX(x) #x
183 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
185 #define __ITT_BUILD_ASSERT(expr, suffix) do { \
186 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
187 __itt_build_check_##suffix[0] = 0; \
189 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
190 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
192 #define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
195 #define API_VERSION_BUILD 20180723
197 #ifndef API_VERSION_NUM
198 #define API_VERSION_NUM 0.0.0
201 #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
202 " (" ITT_TO_STR(API_VERSION_BUILD) ")"
205 #if ITT_PLATFORM==ITT_PLATFORM_WIN
210 #define MUTEX_INITIALIZER { 0 }
211 #define strong_alias(name, aliasname)
214 #if defined(UNICODE) || defined(_UNICODE)
218 #define _GNU_SOURCE 1
221 #define __USE_UNIX98 1
225 typedef pthread_t
TIDT;
226 typedef pthread_mutex_t
mutex_t;
227 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
228 #define _strong_alias(name, aliasname) \
229 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
230 #define strong_alias(name, aliasname) _strong_alias(name, aliasname)
233 #if ITT_PLATFORM==ITT_PLATFORM_WIN
234 #define __itt_get_proc(lib, name) GetProcAddress(lib, name)
235 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
236 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
237 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
238 #define __itt_load_lib(name) LoadLibraryA(name)
239 #define __itt_unload_lib(handle) FreeLibrary(handle)
240 #define __itt_system_error() (int)GetLastError()
241 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
242 #define __itt_fstrnlen(s, l) strnlen_s(s, l)
243 #define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l)
244 #define __itt_fstrdup(s) _strdup(s)
245 #define __itt_thread_id() GetCurrentThreadId()
246 #define __itt_thread_yield() SwitchToThread()
247 #ifndef ITT_SIMPLE_INIT
252 return InterlockedIncrement(ptr);
256 #define DL_SYMBOLS (1)
257 #define PTHREAD_SYMBOLS (1)
260 #define __itt_get_proc(lib, name) dlsym(lib, name)
261 #define __itt_mutex_init(mutex) {\
262 pthread_mutexattr_t mutex_attr; \
263 int error_code = pthread_mutexattr_init(&mutex_attr); \
265 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
267 error_code = pthread_mutexattr_settype(&mutex_attr, \
268 PTHREAD_MUTEX_RECURSIVE); \
270 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
272 error_code = pthread_mutex_init(mutex, &mutex_attr); \
274 __itt_report_error(__itt_error_system, "pthread_mutex_init", \
276 error_code = pthread_mutexattr_destroy(&mutex_attr); \
278 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
281 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
282 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
283 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
284 #define __itt_unload_lib(handle) dlclose(handle)
285 #define __itt_system_error() errno
286 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
290 #define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l)
292 #define __itt_fstrnlen(s, l) strlen(s)
295 #define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
297 #define __itt_fstrcpyn(s1, b, s2, l) { \
301 volatile size_t num_to_copy = (size_t)(b - 1) < (size_t)(l) ? \
302 (size_t)(b - 1) : (size_t)(l); \
303 strncpy(s1, s2, num_to_copy); \
304 s1[num_to_copy] = 0; \
309 #define __itt_fstrdup(s) strdup(s)
310 #define __itt_thread_id() pthread_self()
311 #define __itt_thread_yield() sched_yield()
312 #if ITT_ARCH==ITT_ARCH_IA64
313 #ifdef __INTEL_COMPILER
314 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
318 #elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E
324 __asm__ __volatile__(
"lock\nxadd %0,%1"
325 :
"=r"(result),
"=m"(*(
int*)ptr)
326 :
"0"(addend),
"m"(*(
int*)ptr)
330 #elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
331 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
333 #ifndef ITT_SIMPLE_INIT
342 void* dlopen(
const char*,
int) __attribute__((weak));
343 void* dlsym(
void*,
const char*) __attribute__((weak));
344 int dlclose(
void*) __attribute__((weak));
345 #define DL_SYMBOLS (dlopen && dlsym && dlclose)
347 int pthread_mutex_init(pthread_mutex_t*,
const pthread_mutexattr_t*) __attribute__((weak));
348 int pthread_mutex_lock(pthread_mutex_t*) __attribute__((weak));
349 int pthread_mutex_unlock(pthread_mutex_t*) __attribute__((weak));
350 int pthread_mutex_destroy(pthread_mutex_t*) __attribute__((weak));
351 int pthread_mutexattr_init(pthread_mutexattr_t*) __attribute__((weak));
352 int pthread_mutexattr_settype(pthread_mutexattr_t*,
int) __attribute__((weak));
353 int pthread_mutexattr_destroy(pthread_mutexattr_t*) __attribute__((weak));
354 pthread_t pthread_self(
void) __attribute__((weak));
355 #define PTHREAD_SYMBOLS (pthread_mutex_init && pthread_mutex_lock && pthread_mutex_unlock && pthread_mutex_destroy && pthread_mutexattr_init && pthread_mutexattr_settype && pthread_mutexattr_destroy && pthread_self)
369 #pragma pack(push, 8)
374 #if defined(UNICODE) || defined(_UNICODE)
375 const wchar_t*
nameW;
408 #if defined(UNICODE) || defined(_UNICODE)
409 const wchar_t*
nameW;
414 #if defined(UNICODE) || defined(_UNICODE)
426 struct ___itt_domain;
427 struct ___itt_string_handle;
455 #define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
456 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
460 h->nameW = n ? _wcsdup(n) : NULL; \
465 if (h_tail == NULL) \
466 (gptr)->thread_list = h; \
472 #define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
473 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
476 h->nameA = n ? __itt_fstrdup(n) : NULL; \
482 if (h_tail == NULL) \
483 (gptr)->thread_list = h; \
489 #define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
490 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
494 h->nameW = name ? _wcsdup(name) : NULL; \
498 if (h_tail == NULL) \
499 (gptr)->domain_list = h; \
505 #define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
506 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
509 h->nameA = name ? __itt_fstrdup(name) : NULL; \
514 if (h_tail == NULL) \
515 (gptr)->domain_list = h; \
521 #define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
522 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
525 h->strW = name ? _wcsdup(name) : NULL; \
529 if (h_tail == NULL) \
530 (gptr)->string_list = h; \
536 #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
537 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
539 h->strA = name ? __itt_fstrdup(name) : NULL; \
544 if (h_tail == NULL) \
545 (gptr)->string_list = h; \
551 #define NEW_COUNTER_W(gptr,h,h_tail,name,domain,type) { \
552 h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
555 h->nameW = name ? _wcsdup(name) : NULL; \
557 h->domainW = name ? _wcsdup(domain) : NULL; \
561 if (h_tail == NULL) \
562 (gptr)->counter_list = h; \
568 #define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \
569 h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
571 h->nameA = name ? __itt_fstrdup(name) : NULL; \
573 h->domainA = domain ? __itt_fstrdup(domain) : NULL; \
578 if (h_tail == NULL) \
579 (gptr)->counter_list = h; \
long __TBB_machine_fetchadd4(volatile void *ptr, __int32 addend)
struct __itt_counter_info __itt_counter_info_t
@ __itt_collection_paused
@ __itt_collection_normal
ITT_INLINE long __itt_interlocked_increment(volatile long *ptr) ITT_INLINE_ATTRIBUTE
struct ___itt_global __itt_global
struct ___itt_api_info_20101001 __itt_api_info_20101001
struct ___itt_api_info __itt_api_info
struct ___itt_thread_info __itt_thread_info
enum ___itt_group_id __itt_group_id
struct ___itt_thread_info * next
struct __itt_counter_info * next
struct ___itt_domain * domain_list
volatile long atomic_counter
unsigned long version_minor
unsigned long version_build
unsigned int ipt_collect_events
volatile long mutex_initialized
const char ** dll_path_ptr
__itt_counter_info_t * counter_list
__itt_thread_info * thread_list
unsigned long version_major
__itt_api_info * api_list_ptr
struct ___itt_string_handle * string_list
struct ___itt_global * next
volatile long api_initialized
__itt_collection_state state