19 #ifndef _ITTNOTIFY_CONFIG_H_
20 #define _ITTNOTIFY_CONFIG_H_
28 # define ITT_OS_LINUX 2
36 # if defined WIN32 || defined _WIN32
37 # define ITT_OS ITT_OS_WIN
38 # elif defined( __APPLE__ ) && defined( __MACH__ )
39 # define ITT_OS ITT_OS_MAC
41 # define ITT_OS ITT_OS_LINUX
45 #ifndef ITT_PLATFORM_WIN
46 # define ITT_PLATFORM_WIN 1
49 #ifndef ITT_PLATFORM_POSIX
50 # define ITT_PLATFORM_POSIX 2
54 # if ITT_OS==ITT_OS_WIN
55 # define ITT_PLATFORM ITT_PLATFORM_WIN
57 # define ITT_PLATFORM ITT_PLATFORM_POSIX
61 #if defined(_UNICODE) && !defined(UNICODE)
66 #if ITT_PLATFORM==ITT_PLATFORM_WIN
70 #if defined(UNICODE) || defined(_UNICODE)
76 # if ITT_PLATFORM==ITT_PLATFORM_WIN
77 # define CDECL __cdecl
79 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
82 # define CDECL __attribute__ ((cdecl))
88 # if ITT_PLATFORM==ITT_PLATFORM_WIN
89 # define STDCALL __stdcall
91 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
94 # define STDCALL __attribute__ ((stdcall))
100 #define LIBITTAPI CDECL
103 #define ITTAPI_CALL CDECL
104 #define LIBITTAPI_CALL CDECL
106 #if ITT_PLATFORM==ITT_PLATFORM_WIN
108 #define ITT_INLINE __forceinline
109 #define ITT_INLINE_ATTRIBUTE
116 #ifdef __STRICT_ANSI__
117 #define ITT_INLINE static
119 #define ITT_INLINE static inline
121 #define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline))
125 #ifndef ITT_ARCH_IA32
126 # define ITT_ARCH_IA32 1
129 #ifndef ITT_ARCH_IA32E
130 # define ITT_ARCH_IA32E 2
133 #ifndef ITT_ARCH_IA64
134 # define ITT_ARCH_IA64 3
138 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
139 # define ITT_ARCH ITT_ARCH_IA32E
140 # elif defined _M_IA64 || defined __ia64
141 # define ITT_ARCH ITT_ARCH_IA64
143 # define ITT_ARCH ITT_ARCH_IA32
148 # define ITT_EXTERN_C extern "C"
150 # define ITT_EXTERN_C
153 #define ITT_TO_STR_AUX(x) #x
154 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
156 #define __ITT_BUILD_ASSERT(expr, suffix) do { \
157 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
158 __itt_build_check_##suffix[0] = 0; \
160 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
161 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
163 #define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
166 #define API_VERSION_BUILD 20111111
168 #ifndef API_VERSION_NUM
169 #define API_VERSION_NUM 0.0.0
172 #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
173 " (" ITT_TO_STR(API_VERSION_BUILD) ")"
176 #if ITT_PLATFORM==ITT_PLATFORM_WIN
181 #define MUTEX_INITIALIZER { 0 }
182 #define strong_alias(name, aliasname)
185 #if defined(UNICODE) || defined(_UNICODE)
189 #define _GNU_SOURCE 1
193 typedef pthread_t
TIDT;
194 typedef pthread_mutex_t
mutex_t;
195 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
196 #define _strong_alias(name, aliasname) \
197 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
198 #define strong_alias(name, aliasname) _strong_alias(name, aliasname)
201 #if ITT_PLATFORM==ITT_PLATFORM_WIN
202 #define __itt_get_proc(lib, name) GetProcAddress(lib, name)
203 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
204 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
205 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
206 #define __itt_load_lib(name) LoadLibraryA(name)
207 #define __itt_unload_lib(handle) FreeLibrary(handle)
208 #define __itt_system_error() (int)GetLastError()
209 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
210 #define __itt_fstrlen(s) lstrlenA(s)
211 #define __itt_fstrcpyn(s1, s2, l) lstrcpynA(s1, s2, l)
212 #define __itt_fstrdup(s) _strdup(s)
213 #define __itt_thread_id() GetCurrentThreadId()
214 #define __itt_thread_yield() SwitchToThread()
215 #ifndef ITT_SIMPLE_INIT
220 return InterlockedIncrement(ptr);
224 #define __itt_get_proc(lib, name) dlsym(lib, name)
225 #define __itt_mutex_init(mutex) {\
226 pthread_mutexattr_t mutex_attr; \
227 int error_code = pthread_mutexattr_init(&mutex_attr); \
229 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
231 error_code = pthread_mutexattr_settype(&mutex_attr, \
232 PTHREAD_MUTEX_RECURSIVE); \
234 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
236 error_code = pthread_mutex_init(mutex, &mutex_attr); \
238 __itt_report_error(__itt_error_system, "pthread_mutex_init", \
240 error_code = pthread_mutexattr_destroy(&mutex_attr); \
242 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
245 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
246 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
247 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
248 #define __itt_unload_lib(handle) dlclose(handle)
249 #define __itt_system_error() errno
250 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
251 #define __itt_fstrlen(s) strlen(s)
252 #define __itt_fstrcpyn(s1, s2, l) strncpy(s1, s2, l)
253 #define __itt_fstrdup(s) strdup(s)
254 #define __itt_thread_id() pthread_self()
255 #define __itt_thread_yield() sched_yield()
256 #if ITT_ARCH==ITT_ARCH_IA64
257 #ifdef __INTEL_COMPILER
258 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
264 __TBB_machine_fetchadd4(
volatile void* ptr,
long addend) ITT_INLINE_ATTRIBUTE;
265 ITT_INLINE
long __TBB_machine_fetchadd4(
volatile void* ptr,
long addend)
268 __asm__ __volatile__(
"lock\nxadd %0,%1"
269 :
"=r"(result),
"=m"(*(
long*)ptr)
270 :
"0"(addend),
"m"(*(
long*)ptr)
275 #ifndef ITT_SIMPLE_INIT
280 return __TBB_machine_fetchadd4(ptr, 1) + 1L;
295 #pragma pack(push, 8)
300 #if defined(UNICODE) || defined(_UNICODE)
301 const wchar_t*
nameW;
331 struct ___itt_domain;
332 struct ___itt_string_handle;
358 #define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
359 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
363 h->nameW = n ? _wcsdup(n) : NULL; \
368 if (h_tail == NULL) \
369 (gptr)->thread_list = h; \
375 #define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
376 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
379 h->nameA = n ? __itt_fstrdup(n) : NULL; \
385 if (h_tail == NULL) \
386 (gptr)->thread_list = h; \
392 #define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
393 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
397 h->nameW = name ? _wcsdup(name) : NULL; \
401 if (h_tail == NULL) \
402 (gptr)->domain_list = h; \
408 #define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
409 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
412 h->nameA = name ? __itt_fstrdup(name) : NULL; \
417 if (h_tail == NULL) \
418 (gptr)->domain_list = h; \
424 #define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
425 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
428 h->strW = name ? _wcsdup(name) : NULL; \
432 if (h_tail == NULL) \
433 (gptr)->string_list = h; \
439 #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
440 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
442 h->strA = name ? __itt_fstrdup(name) : NULL; \
447 if (h_tail == NULL) \
448 (gptr)->string_list = h; \
ITT_INLINE long __itt_interlocked_increment(volatile long *ptr) ITT_INLINE_ATTRIBUTE
struct ___itt_api_info_20101001 __itt_api_info_20101001
__itt_api_info * api_list_ptr
__itt_collection_state state
struct ___itt_domain * domain_list
enum ___itt_group_id __itt_group_id
volatile long mutex_initialized
unsigned long version_minor
unsigned long version_major
volatile long api_initialized
struct ___itt_thread_info __itt_thread_info
struct ___itt_thread_info * next
volatile long atomic_counter
struct ___itt_global __itt_global
struct ___itt_api_info __itt_api_info
struct ___itt_string_handle * string_list
struct ___itt_global * next
__itt_thread_info * thread_list
unsigned long version_build
const char ** dll_path_ptr