18#ifndef _ITTNOTIFY_CONFIG_H_
19#define _ITTNOTIFY_CONFIG_H_
27# define ITT_OS_LINUX 2
35# if defined WIN32 || defined _WIN32
36# define ITT_OS ITT_OS_WIN
37# elif defined( __APPLE__ ) && defined( __MACH__ )
38# define ITT_OS ITT_OS_MAC
40# define ITT_OS ITT_OS_LINUX
44#ifndef ITT_PLATFORM_WIN
45# define ITT_PLATFORM_WIN 1
48#ifndef ITT_PLATFORM_POSIX
49# define ITT_PLATFORM_POSIX 2
53# if ITT_OS==ITT_OS_WIN
54# define ITT_PLATFORM ITT_PLATFORM_WIN
56# define ITT_PLATFORM ITT_PLATFORM_POSIX
60#if defined(_UNICODE) && !defined(UNICODE)
65#if ITT_PLATFORM==ITT_PLATFORM_WIN
69#if defined(UNICODE) || defined(_UNICODE)
75# if ITT_PLATFORM==ITT_PLATFORM_WIN
78# if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
81# define CDECL __attribute__ ((cdecl))
87# if ITT_PLATFORM==ITT_PLATFORM_WIN
88# define STDCALL __stdcall
90# if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
93# define STDCALL __attribute__ ((stdcall))
99#define LIBITTAPI CDECL
102#define ITTAPI_CALL CDECL
103#define LIBITTAPI_CALL CDECL
105#if ITT_PLATFORM==ITT_PLATFORM_WIN
107#define ITT_INLINE __forceinline
108#define ITT_INLINE_ATTRIBUTE
115#ifdef __STRICT_ANSI__
116#define ITT_INLINE static
118#define ITT_INLINE static inline
120#define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline))
125# define ITT_ARCH_IA32 1
128#ifndef ITT_ARCH_IA32E
129# define ITT_ARCH_IA32E 2
133# define ITT_ARCH_IA64 3
137# if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
138# define ITT_ARCH ITT_ARCH_IA32E
139# elif defined _M_IA64 || defined __ia64
140# define ITT_ARCH ITT_ARCH_IA64
142# define ITT_ARCH ITT_ARCH_IA32
147# define ITT_EXTERN_C extern "C"
152#define ITT_TO_STR_AUX(x) #x
153#define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
155#define __ITT_BUILD_ASSERT(expr, suffix) do { \
156 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
157 __itt_build_check_##suffix[0] = 0; \
159#define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
160#define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
162#define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
165#define API_VERSION_BUILD 20111111
167#ifndef API_VERSION_NUM
168#define API_VERSION_NUM 0.0.0
171#define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
172 " (" ITT_TO_STR(API_VERSION_BUILD) ")"
175#if ITT_PLATFORM==ITT_PLATFORM_WIN
180#define MUTEX_INITIALIZER { 0 }
181#define strong_alias(name, aliasname)
184#if defined(UNICODE) || defined(_UNICODE)
192typedef pthread_t
TIDT;
193typedef pthread_mutex_t
mutex_t;
194#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
195#define _strong_alias(name, aliasname) \
196 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
197#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
200#if ITT_PLATFORM==ITT_PLATFORM_WIN
201#define __itt_get_proc(lib, name) GetProcAddress(lib, name)
202#define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
203#define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
204#define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
205#define __itt_load_lib(name) LoadLibraryA(name)
206#define __itt_unload_lib(handle) FreeLibrary(handle)
207#define __itt_system_error() (int)GetLastError()
208#define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
209#define __itt_fstrlen(s) lstrlenA(s)
210#define __itt_fstrcpyn(s1, s2, l) lstrcpynA(s1, s2, l)
211#define __itt_fstrdup(s) _strdup(s)
212#define __itt_thread_id() GetCurrentThreadId()
213#define __itt_thread_yield() SwitchToThread()
214#ifndef ITT_SIMPLE_INIT
219 return InterlockedIncrement(ptr);
223#define __itt_get_proc(lib, name) dlsym(lib, name)
224#define __itt_mutex_init(mutex) {\
225 pthread_mutexattr_t mutex_attr; \
226 int error_code = pthread_mutexattr_init(&mutex_attr); \
228 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
230 error_code = pthread_mutexattr_settype(&mutex_attr, \
231 PTHREAD_MUTEX_RECURSIVE); \
233 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
235 error_code = pthread_mutex_init(mutex, &mutex_attr); \
237 __itt_report_error(__itt_error_system, "pthread_mutex_init", \
239 error_code = pthread_mutexattr_destroy(&mutex_attr); \
241 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
244#define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
245#define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
246#define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
247#define __itt_unload_lib(handle) dlclose(handle)
248#define __itt_system_error() errno
249#define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
250#define __itt_fstrlen(s) strlen(s)
251#define __itt_fstrcpyn(s1, s2, l) strncpy(s1, s2, l)
252#define __itt_fstrdup(s) strdup(s)
253#define __itt_thread_id() pthread_self()
254#define __itt_thread_yield() sched_yield()
255#if ITT_ARCH==ITT_ARCH_IA64
256#ifdef __INTEL_COMPILER
257#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
263__TBB_machine_fetchadd4(
volatile void* ptr,
long addend) ITT_INLINE_ATTRIBUTE;
264ITT_INLINE
long __TBB_machine_fetchadd4(
volatile void* ptr,
long addend)
267 __asm__ __volatile__(
"lock\nxadd %0,%1"
268 :
"=r"(result),
"=m"(*(
long*)ptr)
269 :
"0"(addend),
"m"(*(
long*)ptr)
274#ifndef ITT_SIMPLE_INIT
279 return __TBB_machine_fetchadd4(ptr, 1) + 1L;
299#if defined(UNICODE) || defined(_UNICODE)
300 const wchar_t*
nameW;
331struct ___itt_string_handle;
357#define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
358 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
362 h->nameW = n ? _wcsdup(n) : NULL; \
367 if (h_tail == NULL) \
368 (gptr)->thread_list = h; \
374#define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
375 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
378 h->nameA = n ? __itt_fstrdup(n) : NULL; \
384 if (h_tail == NULL) \
385 (gptr)->thread_list = h; \
391#define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
392 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
396 h->nameW = name ? _wcsdup(name) : NULL; \
400 if (h_tail == NULL) \
401 (gptr)->domain_list = h; \
407#define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
408 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
411 h->nameA = name ? __itt_fstrdup(name) : NULL; \
416 if (h_tail == NULL) \
417 (gptr)->domain_list = h; \
423#define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
424 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
427 h->strW = name ? _wcsdup(name) : NULL; \
431 if (h_tail == NULL) \
432 (gptr)->string_list = h; \
438#define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
439 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
441 h->strA = name ? __itt_fstrdup(name) : NULL; \
446 if (h_tail == NULL) \
447 (gptr)->string_list = h; \
@ __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_domain * domain_list
volatile long atomic_counter
unsigned long version_minor
unsigned long version_build
volatile long mutex_initialized
const char ** dll_path_ptr
__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
struct ___itt_thread_info * next
int extra1
Reserved to the runtime.
void * extra2
Reserved to the runtime.
__itt_thread_state state
Thread state (paused or normal)
const char * nameA
Copy of original name in ASCII.