58 #ifndef _ITTNOTIFY_CONFIG_H_ 59 #define _ITTNOTIFY_CONFIG_H_ 67 # define ITT_OS_LINUX 2 75 # if defined WIN32 || defined _WIN32 76 # define ITT_OS ITT_OS_WIN 77 # elif defined( __APPLE__ ) && defined( __MACH__ ) 78 # define ITT_OS ITT_OS_MAC 80 # define ITT_OS ITT_OS_LINUX 84 #ifndef ITT_PLATFORM_WIN 85 # define ITT_PLATFORM_WIN 1 88 #ifndef ITT_PLATFORM_POSIX 89 # define ITT_PLATFORM_POSIX 2 93 # if ITT_OS==ITT_OS_WIN 94 # define ITT_PLATFORM ITT_PLATFORM_WIN 96 # define ITT_PLATFORM ITT_PLATFORM_POSIX 100 #if defined(_UNICODE) && !defined(UNICODE) 105 #if ITT_PLATFORM==ITT_PLATFORM_WIN 109 #if defined(UNICODE) || defined(_UNICODE) 115 # if ITT_PLATFORM==ITT_PLATFORM_WIN 116 # define CDECL __cdecl 118 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ 121 # define CDECL __attribute__ ((cdecl)) 127 # if ITT_PLATFORM==ITT_PLATFORM_WIN 128 # define STDCALL __stdcall 130 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ 133 # define STDCALL __attribute__ ((stdcall)) 139 #define LIBITTAPI CDECL 142 #define ITTAPI_CALL CDECL 143 #define LIBITTAPI_CALL CDECL 145 #if ITT_PLATFORM==ITT_PLATFORM_WIN 147 #define ITT_INLINE __forceinline 148 #define ITT_INLINE_ATTRIBUTE 155 #ifdef __STRICT_ANSI__ 156 #define ITT_INLINE static 158 #define ITT_INLINE static inline 160 #define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline)) 164 #ifndef ITT_ARCH_IA32 165 # define ITT_ARCH_IA32 1 168 #ifndef ITT_ARCH_IA32E 169 # define ITT_ARCH_IA32E 2 172 #ifndef ITT_ARCH_IA64 173 # define ITT_ARCH_IA64 3 177 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ 178 # define ITT_ARCH ITT_ARCH_IA32E 179 # elif defined _M_IA64 || defined __ia64 180 # define ITT_ARCH ITT_ARCH_IA64 182 # define ITT_ARCH ITT_ARCH_IA32 187 # define ITT_EXTERN_C extern "C" 189 # define ITT_EXTERN_C 192 #define ITT_TO_STR_AUX(x) #x 193 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x) 195 #define __ITT_BUILD_ASSERT(expr, suffix) do { static char __itt_build_check_##suffix[(expr) ? 1 : -1]; __itt_build_check_##suffix[0] = 0; } while(0) 196 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix) 197 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__) 199 #define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 } 202 #define API_VERSION_BUILD 20111111 204 #ifndef API_VERSION_NUM 205 #define API_VERSION_NUM 0.0.0 208 #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) " (" ITT_TO_STR(API_VERSION_BUILD) ")" 211 #if ITT_PLATFORM==ITT_PLATFORM_WIN 213 typedef HMODULE lib_t;
215 typedef CRITICAL_SECTION mutex_t;
216 #define MUTEX_INITIALIZER { 0 } 217 #define strong_alias(name, aliasname) 220 #if defined(UNICODE) || defined(_UNICODE) 224 #define _GNU_SOURCE 1 228 typedef pthread_t TIDT;
229 typedef pthread_mutex_t mutex_t;
230 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER 231 #define _strong_alias(name, aliasname) extern __typeof (name) aliasname __attribute__ ((alias (#name))); 232 #define strong_alias(name, aliasname) _strong_alias(name, aliasname) 235 #if ITT_PLATFORM==ITT_PLATFORM_WIN 236 #define __itt_get_proc(lib, name) GetProcAddress(lib, name) 237 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex) 238 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex) 239 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex) 240 #define __itt_load_lib(name) LoadLibraryA(name) 241 #define __itt_unload_lib(handle) FreeLibrary(handle) 242 #define __itt_system_error() (int)GetLastError() 243 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2) 244 #define __itt_fstrlen(s) lstrlenA(s) 245 #define __itt_fstrcpyn(s1, s2, l) lstrcpynA(s1, s2, l) 246 #define __itt_fstrdup(s) _strdup(s) 247 #define __itt_thread_id() GetCurrentThreadId() 248 #define __itt_thread_yield() SwitchToThread() 249 #ifndef ITT_SIMPLE_INIT 250 ITT_INLINE
int __itt_interlocked_increment(
volatile long* ptr) ITT_INLINE_ATTRIBUTE;
251 ITT_INLINE
int __itt_interlocked_increment(
volatile long* ptr)
253 return InterlockedIncrement(ptr);
257 #define __itt_get_proc(lib, name) dlsym(lib, name) 258 #define __itt_mutex_init(mutex) \ 260 pthread_mutexattr_t mutex_attr; \ 261 int error_code = pthread_mutexattr_init(&mutex_attr); \ 263 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", error_code); \ 264 error_code = pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE); \ 266 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", error_code); \ 267 error_code = pthread_mutex_init(mutex, &mutex_attr); \ 269 __itt_report_error(__itt_error_system, "pthread_mutex_init", error_code); \ 270 error_code = pthread_mutexattr_destroy(&mutex_attr); \ 272 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", error_code); \ 274 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex) 275 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex) 276 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY) 277 #define __itt_unload_lib(handle) dlclose(handle) 278 #define __itt_system_error() errno 279 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2) 280 #define __itt_fstrlen(s) strlen(s) 281 #define __itt_fstrcpyn(s1, s2, l) strncpy(s1, s2, l) 282 #define __itt_fstrdup(s) strdup(s) 283 #define __itt_thread_id() pthread_self() 284 #define __itt_thread_yield() sched_yield() 285 #if ITT_ARCH==ITT_ARCH_IA64 286 #ifdef __INTEL_COMPILER 287 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val) 304 #ifndef ITT_SIMPLE_INIT 315 __itt_collection_normal = 0,
316 __itt_collection_paused = 1
317 } __itt_collection_state;
320 __itt_thread_normal = 0,
321 __itt_thread_ignored = 1
322 } __itt_thread_state;
324 #pragma pack(push, 8) 329 #if defined(UNICODE) || defined(_UNICODE) 330 const wchar_t* nameW;
341 #include "ittnotify_types.h" 348 __itt_group_id group;
357 __itt_group_id group;
360 struct ___itt_domain;
361 struct ___itt_string_handle;
365 unsigned char magic[8];
366 unsigned long version_major;
367 unsigned long version_minor;
368 unsigned long version_build;
369 volatile long api_initialized;
370 volatile long mutex_initialized;
371 volatile long atomic_counter;
375 const char** dll_path_ptr;
380 struct ___itt_domain* domain_list;
381 struct ___itt_string_handle* string_list;
382 __itt_collection_state state;
387 #define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \ 388 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ 392 h->nameW = n ? _wcsdup(n) : NULL; \ 397 if (h_tail == NULL) \ 398 (gptr)->thread_list = h; \ 404 #define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \ 405 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ 408 h->nameA = n ? __itt_fstrdup(n) : NULL; \ 414 if (h_tail == NULL) \ 415 (gptr)->thread_list = h; \ 421 #define NEW_DOMAIN_W(gptr,h,h_tail,name) { \ 422 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ 426 h->nameW = name ? _wcsdup(name) : NULL; \ 430 if (h_tail == NULL) \ 431 (gptr)->domain_list = h; \ 437 #define NEW_DOMAIN_A(gptr,h,h_tail,name) { \ 438 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ 441 h->nameA = name ? __itt_fstrdup(name) : NULL; \ 446 if (h_tail == NULL) \ 447 (gptr)->domain_list = h; \ 453 #define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \ 454 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ 457 h->strW = name ? _wcsdup(name) : NULL; \ 461 if (h_tail == NULL) \ 462 (gptr)->string_list = h; \ 468 #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \ 469 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ 471 h->strA = name ? __itt_fstrdup(name) : NULL; \ 476 if (h_tail == NULL) \ 477 (gptr)->string_list = h; \