1 /* 2 Copyright (c) 2005-2022 Intel Corporation 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 #ifndef _ITTNOTIFY_CONFIG_H_ 18 #define _ITTNOTIFY_CONFIG_H_ 19 20 /** @cond exclude_from_documentation */ 21 #ifndef ITT_OS_WIN 22 # define ITT_OS_WIN 1 23 #endif /* ITT_OS_WIN */ 24 25 #ifndef ITT_OS_LINUX 26 # define ITT_OS_LINUX 2 27 #endif /* ITT_OS_LINUX */ 28 29 #ifndef ITT_OS_MAC 30 # define ITT_OS_MAC 3 31 #endif /* ITT_OS_MAC */ 32 33 #ifndef ITT_OS_FREEBSD 34 # define ITT_OS_FREEBSD 4 35 #endif /* ITT_OS_FREEBSD */ 36 37 #ifndef ITT_OS 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 44 # else 45 # define ITT_OS ITT_OS_LINUX 46 # endif 47 #endif /* ITT_OS */ 48 49 #ifndef ITT_PLATFORM_WIN 50 # define ITT_PLATFORM_WIN 1 51 #endif /* ITT_PLATFORM_WIN */ 52 53 #ifndef ITT_PLATFORM_POSIX 54 # define ITT_PLATFORM_POSIX 2 55 #endif /* ITT_PLATFORM_POSIX */ 56 57 #ifndef ITT_PLATFORM_MAC 58 # define ITT_PLATFORM_MAC 3 59 #endif /* ITT_PLATFORM_MAC */ 60 61 #ifndef ITT_PLATFORM_FREEBSD 62 # define ITT_PLATFORM_FREEBSD 4 63 #endif /* ITT_PLATFORM_FREEBSD */ 64 65 #ifndef ITT_PLATFORM 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 72 # else 73 # define ITT_PLATFORM ITT_PLATFORM_POSIX 74 # endif 75 #endif /* ITT_PLATFORM */ 76 77 #if defined(_UNICODE) && !defined(UNICODE) 78 #define UNICODE 79 #endif 80 81 #include <stddef.h> 82 #if ITT_PLATFORM==ITT_PLATFORM_WIN 83 #include <tchar.h> 84 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 85 #include <stdint.h> 86 #if defined(UNICODE) || defined(_UNICODE) 87 #include <wchar.h> 88 #endif /* UNICODE || _UNICODE */ 89 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 90 91 #ifndef ITTAPI_CDECL 92 # if ITT_PLATFORM==ITT_PLATFORM_WIN 93 # define ITTAPI_CDECL __cdecl 94 # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 95 # if defined _M_IX86 || defined __i386__ 96 # define ITTAPI_CDECL __attribute__ ((cdecl)) 97 # else /* _M_IX86 || __i386__ */ 98 # define ITTAPI_CDECL /* actual only on x86 platform */ 99 # endif /* _M_IX86 || __i386__ */ 100 # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 101 #endif /* ITTAPI_CDECL */ 102 103 #ifndef STDCALL 104 # if ITT_PLATFORM==ITT_PLATFORM_WIN 105 # define STDCALL __stdcall 106 # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 107 # if defined _M_IX86 || defined __i386__ 108 # define STDCALL __attribute__ ((stdcall)) 109 # else /* _M_IX86 || __i386__ */ 110 # define STDCALL /* supported only on x86 platform */ 111 # endif /* _M_IX86 || __i386__ */ 112 # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 113 #endif /* STDCALL */ 114 115 #define ITTAPI ITTAPI_CDECL 116 #define LIBITTAPI ITTAPI_CDECL 117 118 /* TODO: Temporary for compatibility! */ 119 #define ITTAPI_CALL ITTAPI_CDECL 120 #define LIBITTAPI_CALL ITTAPI_CDECL 121 122 #if ITT_PLATFORM==ITT_PLATFORM_WIN 123 /* use __forceinline (VC++ specific) */ 124 #define ITT_INLINE static __forceinline 125 #define ITT_INLINE_ATTRIBUTE /* nothing */ 126 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 127 /* 128 * Generally, functions are not inlined unless optimization is specified. 129 * For functions declared inline, this attribute inlines the function even 130 * if no optimization level was specified. 131 */ 132 #ifdef __STRICT_ANSI__ 133 #define ITT_INLINE static 134 #define ITT_INLINE_ATTRIBUTE __attribute__((unused)) 135 #else /* __STRICT_ANSI__ */ 136 #define ITT_INLINE static inline 137 #define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) 138 #endif /* __STRICT_ANSI__ */ 139 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 140 /** @endcond */ 141 142 #ifndef ITT_ARCH_IA32 143 # define ITT_ARCH_IA32 1 144 #endif /* ITT_ARCH_IA32 */ 145 146 #ifndef ITT_ARCH_IA32E 147 # define ITT_ARCH_IA32E 2 148 #endif /* ITT_ARCH_IA32E */ 149 150 #ifndef ITT_ARCH_IA64 151 # define ITT_ARCH_IA64 3 152 #endif /* ITT_ARCH_IA64 */ 153 154 #ifndef ITT_ARCH_ARM 155 # define ITT_ARCH_ARM 4 156 #endif /* ITT_ARCH_ARM */ 157 158 #ifndef ITT_ARCH_PPC64 159 # define ITT_ARCH_PPC64 5 160 #endif /* ITT_ARCH_PPC64 */ 161 162 #ifndef ITT_ARCH_ARM64 163 # define ITT_ARCH_ARM64 6 164 #endif /* ITT_ARCH_ARM64 */ 165 166 #ifndef ITT_ARCH_LOONGARCH64 167 # define ITT_ARCH_LOONGARCH64 7 168 #endif /* ITT_ARCH_LOONGARCH64 */ 169 170 #ifndef ITT_ARCH 171 # if defined _M_IX86 || defined __i386__ 172 # define ITT_ARCH ITT_ARCH_IA32 173 # elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__ 174 # define ITT_ARCH ITT_ARCH_IA32E 175 # elif defined _M_IA64 || defined __ia64__ 176 # define ITT_ARCH ITT_ARCH_IA64 177 # elif defined _M_ARM || defined __arm__ 178 # define ITT_ARCH ITT_ARCH_ARM 179 # elif defined __aarch64__ 180 # define ITT_ARCH ITT_ARCH_ARM64 181 # elif defined __powerpc64__ 182 # define ITT_ARCH ITT_ARCH_PPC64 183 # elif defined __loongarch__ 184 # define ITT_ARCH ITT_ARCH_LOONGARCH64 185 # endif 186 #endif 187 188 #ifdef __cplusplus 189 # define ITT_EXTERN_C extern "C" 190 # define ITT_EXTERN_C_BEGIN extern "C" { 191 # define ITT_EXTERN_C_END } 192 #else 193 # define ITT_EXTERN_C /* nothing */ 194 # define ITT_EXTERN_C_BEGIN /* nothing */ 195 # define ITT_EXTERN_C_END /* nothing */ 196 #endif /* __cplusplus */ 197 198 #define ITT_TO_STR_AUX(x) #x 199 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x) 200 201 #define __ITT_BUILD_ASSERT(expr, suffix) do { \ 202 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \ 203 __itt_build_check_##suffix[0] = 0; \ 204 } while(0) 205 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix) 206 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__) 207 208 #define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 } 209 210 /* Replace with snapshot date YYYYMMDD for promotion build. */ 211 #define API_VERSION_BUILD 20180723 212 213 #ifndef API_VERSION_NUM 214 #define API_VERSION_NUM 3.18.6 215 #endif /* API_VERSION_NUM */ 216 217 #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \ 218 " (" ITT_TO_STR(API_VERSION_BUILD) ")" 219 220 /* OS communication functions */ 221 #if ITT_PLATFORM==ITT_PLATFORM_WIN 222 #include <windows.h> 223 typedef HMODULE lib_t; 224 typedef DWORD TIDT; 225 typedef CRITICAL_SECTION mutex_t; 226 #ifdef __cplusplus 227 #define MUTEX_INITIALIZER {} 228 #else 229 #define MUTEX_INITIALIZER { 0 } 230 #endif 231 #define strong_alias(name, aliasname) /* empty for Windows */ 232 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 233 #include <dlfcn.h> 234 #if defined(UNICODE) || defined(_UNICODE) 235 #include <wchar.h> 236 #endif /* UNICODE */ 237 #ifndef _GNU_SOURCE 238 #define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */ 239 #endif /* _GNU_SOURCE */ 240 #ifndef __USE_UNIX98 241 #define __USE_UNIX98 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein pthread.h missing dependency on __USE_XOPEN2K8 */ 242 #endif /*__USE_UNIX98*/ 243 #include <pthread.h> 244 typedef void* lib_t; 245 typedef pthread_t TIDT; 246 typedef pthread_mutex_t mutex_t; 247 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER 248 #define _strong_alias(name, aliasname) \ 249 extern __typeof (name) aliasname __attribute__ ((alias (#name))); 250 #define strong_alias(name, aliasname) _strong_alias(name, aliasname) 251 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 252 253 #if ITT_PLATFORM==ITT_PLATFORM_WIN 254 #define __itt_get_proc(lib, name) GetProcAddress(lib, name) 255 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex) 256 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex) 257 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex) 258 #define __itt_load_lib(name) LoadLibraryA(name) 259 #define __itt_unload_lib(handle) FreeLibrary(handle) 260 #define __itt_system_error() (int)GetLastError() 261 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2) 262 #define __itt_fstrnlen(s, l) strnlen_s(s, l) 263 #define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l) 264 #define __itt_fstrdup(s) _strdup(s) 265 #define __itt_thread_id() GetCurrentThreadId() 266 #define __itt_thread_yield() SwitchToThread() 267 #ifndef ITT_SIMPLE_INIT 268 ITT_INLINE long 269 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE; 270 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) 271 { 272 return InterlockedIncrement(ptr); 273 } 274 #endif /* ITT_SIMPLE_INIT */ 275 276 #define DL_SYMBOLS (1) 277 #define PTHREAD_SYMBOLS (1) 278 279 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ 280 #define __itt_get_proc(lib, name) dlsym(lib, name) 281 #define __itt_mutex_init(mutex) {\ 282 pthread_mutexattr_t mutex_attr; \ 283 int error_code = pthread_mutexattr_init(&mutex_attr); \ 284 if (error_code) \ 285 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \ 286 error_code); \ 287 error_code = pthread_mutexattr_settype(&mutex_attr, \ 288 PTHREAD_MUTEX_RECURSIVE); \ 289 if (error_code) \ 290 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \ 291 error_code); \ 292 error_code = pthread_mutex_init(mutex, &mutex_attr); \ 293 if (error_code) \ 294 __itt_report_error(__itt_error_system, "pthread_mutex_init", \ 295 error_code); \ 296 error_code = pthread_mutexattr_destroy(&mutex_attr); \ 297 if (error_code) \ 298 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \ 299 error_code); \ 300 } 301 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex) 302 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex) 303 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY) 304 #define __itt_unload_lib(handle) dlclose(handle) 305 #define __itt_system_error() errno 306 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2) 307 308 /* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */ 309 #ifdef SDL_STRNLEN_S 310 #define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l) 311 #else 312 #define __itt_fstrnlen(s, l) strlen(s) 313 #endif /* SDL_STRNLEN_S */ 314 #ifdef SDL_STRNCPY_S 315 #define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l) 316 #else 317 #define __itt_fstrcpyn(s1, b, s2, l) { \ 318 if (b > 0) { \ 319 /* 'volatile' is used to suppress the warning that a destination */ \ 320 /* bound depends on the length of the source. */ \ 321 volatile size_t num_to_copy = (size_t)(b - 1) < (size_t)(l) ? \ 322 (size_t)(b - 1) : (size_t)(l); \ 323 strncpy(s1, s2, num_to_copy); \ 324 s1[num_to_copy] = 0; \ 325 } \ 326 } 327 #endif /* SDL_STRNCPY_S */ 328 329 #define __itt_fstrdup(s) strdup(s) 330 #define __itt_thread_id() pthread_self() 331 #define __itt_thread_yield() sched_yield() 332 #if ITT_ARCH==ITT_ARCH_IA64 333 #ifdef __INTEL_COMPILER 334 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val) 335 #else /* __INTEL_COMPILER */ 336 /* TODO: Add Support for not Intel compilers for IA-64 architecture */ 337 #endif /* __INTEL_COMPILER */ 338 #elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */ 339 ITT_INLINE long 340 __TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE; 341 ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend) 342 { 343 long result; 344 __asm__ __volatile__("lock\nxadd %0,%1" 345 : "=r"(result),"=m"(*(volatile int*)ptr) 346 : "0"(addend), "m"(*(volatile int*)ptr) 347 : "memory"); 348 return result; 349 } 350 #else 351 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val) 352 #endif /* ITT_ARCH==ITT_ARCH_IA64 */ 353 #ifndef ITT_SIMPLE_INIT 354 ITT_INLINE long 355 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE; 356 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) 357 { 358 return __TBB_machine_fetchadd4(ptr, 1) + 1L; 359 } 360 #endif /* ITT_SIMPLE_INIT */ 361 362 void* dlopen(const char*, int) __attribute__((weak)); 363 void* dlsym(void*, const char*) __attribute__((weak)); 364 int dlclose(void*) __attribute__((weak)); 365 #define DL_SYMBOLS (dlopen && dlsym && dlclose) 366 367 int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __attribute__((weak)); 368 int pthread_mutex_lock(pthread_mutex_t*) __attribute__((weak)); 369 int pthread_mutex_unlock(pthread_mutex_t*) __attribute__((weak)); 370 int pthread_mutex_destroy(pthread_mutex_t*) __attribute__((weak)); 371 int pthread_mutexattr_init(pthread_mutexattr_t*) __attribute__((weak)); 372 int pthread_mutexattr_settype(pthread_mutexattr_t*, int) __attribute__((weak)); 373 int pthread_mutexattr_destroy(pthread_mutexattr_t*) __attribute__((weak)); 374 pthread_t pthread_self(void) __attribute__((weak)); 375 #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) 376 377 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 378 379 typedef enum { 380 __itt_collection_normal = 0, 381 __itt_collection_paused = 1 382 } __itt_collection_state; 383 384 typedef enum { 385 __itt_thread_normal = 0, 386 __itt_thread_ignored = 1 387 } __itt_thread_state; 388 389 #pragma pack(push, 8) 390 391 typedef struct ___itt_thread_info 392 { 393 const char* nameA; /*!< Copy of original name in ASCII. */ 394 #if defined(UNICODE) || defined(_UNICODE) 395 const wchar_t* nameW; /*!< Copy of original name in UNICODE. */ 396 #else /* UNICODE || _UNICODE */ 397 void* nameW; 398 #endif /* UNICODE || _UNICODE */ 399 TIDT tid; 400 __itt_thread_state state; /*!< Thread state (paused or normal) */ 401 int extra1; /*!< Reserved to the runtime */ 402 void* extra2; /*!< Reserved to the runtime */ 403 struct ___itt_thread_info* next; 404 } __itt_thread_info; 405 406 #include "ittnotify_types.h" /* For __itt_group_id definition */ 407 408 typedef struct ___itt_api_info_20101001 409 { 410 const char* name; 411 void** func_ptr; 412 void* init_func; 413 __itt_group_id group; 414 } __itt_api_info_20101001; 415 416 typedef struct ___itt_api_info 417 { 418 const char* name; 419 void** func_ptr; 420 void* init_func; 421 void* null_func; 422 __itt_group_id group; 423 } __itt_api_info; 424 425 typedef struct __itt_counter_info 426 { 427 const char* nameA; /*!< Copy of original name in ASCII. */ 428 #if defined(UNICODE) || defined(_UNICODE) 429 const wchar_t* nameW; /*!< Copy of original name in UNICODE. */ 430 #else /* UNICODE || _UNICODE */ 431 void* nameW; 432 #endif /* UNICODE || _UNICODE */ 433 const char* domainA; /*!< Copy of original name in ASCII. */ 434 #if defined(UNICODE) || defined(_UNICODE) 435 const wchar_t* domainW; /*!< Copy of original name in UNICODE. */ 436 #else /* UNICODE || _UNICODE */ 437 void* domainW; 438 #endif /* UNICODE || _UNICODE */ 439 int type; 440 long index; 441 int extra1; /*!< Reserved to the runtime */ 442 void* extra2; /*!< Reserved to the runtime */ 443 struct __itt_counter_info* next; 444 } __itt_counter_info_t; 445 446 struct ___itt_domain; 447 struct ___itt_string_handle; 448 449 typedef struct ___itt_global 450 { 451 unsigned char magic[8]; 452 unsigned long version_major; 453 unsigned long version_minor; 454 unsigned long version_build; 455 volatile long api_initialized; 456 volatile long mutex_initialized; 457 volatile long atomic_counter; 458 mutex_t mutex; 459 lib_t lib; 460 void* error_handler; 461 const char** dll_path_ptr; 462 __itt_api_info* api_list_ptr; 463 struct ___itt_global* next; 464 /* Joinable structures below */ 465 __itt_thread_info* thread_list; 466 struct ___itt_domain* domain_list; 467 struct ___itt_string_handle* string_list; 468 __itt_collection_state state; 469 __itt_counter_info_t* counter_list; 470 unsigned int ipt_collect_events; 471 } __itt_global; 472 473 #pragma pack(pop) 474 475 #define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \ 476 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ 477 if (h != NULL) { \ 478 h->tid = t; \ 479 h->nameA = NULL; \ 480 h->nameW = n ? _wcsdup(n) : NULL; \ 481 h->state = s; \ 482 h->extra1 = 0; /* reserved */ \ 483 h->extra2 = NULL; /* reserved */ \ 484 h->next = NULL; \ 485 if (h_tail == NULL) \ 486 (gptr)->thread_list = h; \ 487 else \ 488 h_tail->next = h; \ 489 } \ 490 } 491 492 #define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \ 493 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ 494 if (h != NULL) { \ 495 h->tid = t; \ 496 h->nameA = n ? __itt_fstrdup(n) : NULL; \ 497 h->nameW = NULL; \ 498 h->state = s; \ 499 h->extra1 = 0; /* reserved */ \ 500 h->extra2 = NULL; /* reserved */ \ 501 h->next = NULL; \ 502 if (h_tail == NULL) \ 503 (gptr)->thread_list = h; \ 504 else \ 505 h_tail->next = h; \ 506 } \ 507 } 508 509 #define NEW_DOMAIN_W(gptr,h,h_tail,name) { \ 510 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ 511 if (h != NULL) { \ 512 h->flags = 1; /* domain is enabled by default */ \ 513 h->nameA = NULL; \ 514 h->nameW = name ? _wcsdup(name) : NULL; \ 515 h->extra1 = 0; /* reserved */ \ 516 h->extra2 = NULL; /* reserved */ \ 517 h->next = NULL; \ 518 if (h_tail == NULL) \ 519 (gptr)->domain_list = h; \ 520 else \ 521 h_tail->next = h; \ 522 } \ 523 } 524 525 #define NEW_DOMAIN_A(gptr,h,h_tail,name) { \ 526 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ 527 if (h != NULL) { \ 528 h->flags = 1; /* domain is enabled by default */ \ 529 h->nameA = name ? __itt_fstrdup(name) : NULL; \ 530 h->nameW = NULL; \ 531 h->extra1 = 0; /* reserved */ \ 532 h->extra2 = NULL; /* reserved */ \ 533 h->next = NULL; \ 534 if (h_tail == NULL) \ 535 (gptr)->domain_list = h; \ 536 else \ 537 h_tail->next = h; \ 538 } \ 539 } 540 541 #define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \ 542 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ 543 if (h != NULL) { \ 544 h->strA = NULL; \ 545 h->strW = name ? _wcsdup(name) : NULL; \ 546 h->extra1 = 0; /* reserved */ \ 547 h->extra2 = NULL; /* reserved */ \ 548 h->next = NULL; \ 549 if (h_tail == NULL) \ 550 (gptr)->string_list = h; \ 551 else \ 552 h_tail->next = h; \ 553 } \ 554 } 555 556 #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \ 557 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ 558 if (h != NULL) { \ 559 h->strA = name ? __itt_fstrdup(name) : NULL; \ 560 h->strW = NULL; \ 561 h->extra1 = 0; /* reserved */ \ 562 h->extra2 = NULL; /* reserved */ \ 563 h->next = NULL; \ 564 if (h_tail == NULL) \ 565 (gptr)->string_list = h; \ 566 else \ 567 h_tail->next = h; \ 568 } \ 569 } 570 571 #define NEW_COUNTER_W(gptr,h,h_tail,name,domain,type) { \ 572 h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \ 573 if (h != NULL) { \ 574 h->nameA = NULL; \ 575 h->nameW = name ? _wcsdup(name) : NULL; \ 576 h->domainA = NULL; \ 577 h->domainW = name ? _wcsdup(domain) : NULL; \ 578 h->type = type; \ 579 h->index = 0; \ 580 h->next = NULL; \ 581 if (h_tail == NULL) \ 582 (gptr)->counter_list = h; \ 583 else \ 584 h_tail->next = h; \ 585 } \ 586 } 587 588 #define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \ 589 h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \ 590 if (h != NULL) { \ 591 h->nameA = name ? __itt_fstrdup(name) : NULL; \ 592 h->nameW = NULL; \ 593 h->domainA = domain ? __itt_fstrdup(domain) : NULL; \ 594 h->domainW = NULL; \ 595 h->type = type; \ 596 h->index = 0; \ 597 h->next = NULL; \ 598 if (h_tail == NULL) \ 599 (gptr)->counter_list = h; \ 600 else \ 601 h_tail->next = h; \ 602 } \ 603 } 604 605 #endif /* _ITTNOTIFY_CONFIG_H_ */ 606