js/src/vtune/ittnotify_config.h

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 /*
michael@0 2 This file is provided under a dual BSD/GPLv2 license. When using or
michael@0 3 redistributing this file, you may do so under either license.
michael@0 4
michael@0 5 GPL LICENSE SUMMARY
michael@0 6
michael@0 7 Copyright (c) 2005-2012 Intel Corporation. All rights reserved.
michael@0 8
michael@0 9 This program is free software; you can redistribute it and/or modify
michael@0 10 it under the terms of version 2 of the GNU General Public License as
michael@0 11 published by the Free Software Foundation.
michael@0 12
michael@0 13 This program is distributed in the hope that it will be useful, but
michael@0 14 WITHOUT ANY WARRANTY; without even the implied warranty of
michael@0 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
michael@0 16 General Public License for more details.
michael@0 17
michael@0 18 You should have received a copy of the GNU General Public License
michael@0 19 along with this program; if not, write to the Free Software
michael@0 20 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
michael@0 21 The full GNU General Public License is included in this distribution
michael@0 22 in the file called LICENSE.GPL.
michael@0 23
michael@0 24 Contact Information:
michael@0 25 http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
michael@0 26
michael@0 27 BSD LICENSE
michael@0 28
michael@0 29 Copyright (c) 2005-2012 Intel Corporation. All rights reserved.
michael@0 30 All rights reserved.
michael@0 31
michael@0 32 Redistribution and use in source and binary forms, with or without
michael@0 33 modification, are permitted provided that the following conditions
michael@0 34 are met:
michael@0 35
michael@0 36 * Redistributions of source code must retain the above copyright
michael@0 37 notice, this list of conditions and the following disclaimer.
michael@0 38 * Redistributions in binary form must reproduce the above copyright
michael@0 39 notice, this list of conditions and the following disclaimer in
michael@0 40 the documentation and/or other materials provided with the
michael@0 41 distribution.
michael@0 42 * Neither the name of Intel Corporation nor the names of its
michael@0 43 contributors may be used to endorse or promote products derived
michael@0 44 from this software without specific prior written permission.
michael@0 45
michael@0 46 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 47 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 48 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@0 49 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
michael@0 50 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@0 51 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@0 52 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
michael@0 53 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
michael@0 54 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
michael@0 55 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
michael@0 56 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 57 */
michael@0 58 #ifndef _ITTNOTIFY_CONFIG_H_
michael@0 59 #define _ITTNOTIFY_CONFIG_H_
michael@0 60
michael@0 61 /** @cond exclude_from_documentation */
michael@0 62 #ifndef ITT_OS_WIN
michael@0 63 # define ITT_OS_WIN 1
michael@0 64 #endif /* ITT_OS_WIN */
michael@0 65
michael@0 66 #ifndef ITT_OS_LINUX
michael@0 67 # define ITT_OS_LINUX 2
michael@0 68 #endif /* ITT_OS_LINUX */
michael@0 69
michael@0 70 #ifndef ITT_OS_MAC
michael@0 71 # define ITT_OS_MAC 3
michael@0 72 #endif /* ITT_OS_MAC */
michael@0 73
michael@0 74 #ifndef ITT_OS
michael@0 75 # if defined WIN32 || defined _WIN32
michael@0 76 # define ITT_OS ITT_OS_WIN
michael@0 77 # elif defined( __APPLE__ ) && defined( __MACH__ )
michael@0 78 # define ITT_OS ITT_OS_MAC
michael@0 79 # else
michael@0 80 # define ITT_OS ITT_OS_LINUX
michael@0 81 # endif
michael@0 82 #endif /* ITT_OS */
michael@0 83
michael@0 84 #ifndef ITT_PLATFORM_WIN
michael@0 85 # define ITT_PLATFORM_WIN 1
michael@0 86 #endif /* ITT_PLATFORM_WIN */
michael@0 87
michael@0 88 #ifndef ITT_PLATFORM_POSIX
michael@0 89 # define ITT_PLATFORM_POSIX 2
michael@0 90 #endif /* ITT_PLATFORM_POSIX */
michael@0 91
michael@0 92 #ifndef ITT_PLATFORM
michael@0 93 # if ITT_OS==ITT_OS_WIN
michael@0 94 # define ITT_PLATFORM ITT_PLATFORM_WIN
michael@0 95 # else
michael@0 96 # define ITT_PLATFORM ITT_PLATFORM_POSIX
michael@0 97 # endif /* _WIN32 */
michael@0 98 #endif /* ITT_PLATFORM */
michael@0 99
michael@0 100 #if defined(_UNICODE) && !defined(UNICODE)
michael@0 101 #define UNICODE
michael@0 102 #endif
michael@0 103
michael@0 104 #include <stddef.h>
michael@0 105 #if ITT_PLATFORM==ITT_PLATFORM_WIN
michael@0 106 #include <tchar.h>
michael@0 107 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 108 #include <stdint.h>
michael@0 109 #if defined(UNICODE) || defined(_UNICODE)
michael@0 110 #include <wchar.h>
michael@0 111 #endif /* UNICODE || _UNICODE */
michael@0 112 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 113
michael@0 114 #ifndef CDECL
michael@0 115 # if ITT_PLATFORM==ITT_PLATFORM_WIN
michael@0 116 # define CDECL __cdecl
michael@0 117 # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 118 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
michael@0 119 # define CDECL /* not actual on x86_64 platform */
michael@0 120 # else /* _M_X64 || _M_AMD64 || __x86_64__ */
michael@0 121 # define CDECL __attribute__ ((cdecl))
michael@0 122 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */
michael@0 123 # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 124 #endif /* CDECL */
michael@0 125
michael@0 126 #ifndef STDCALL
michael@0 127 # if ITT_PLATFORM==ITT_PLATFORM_WIN
michael@0 128 # define STDCALL __stdcall
michael@0 129 # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 130 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
michael@0 131 # define STDCALL /* not supported on x86_64 platform */
michael@0 132 # else /* _M_X64 || _M_AMD64 || __x86_64__ */
michael@0 133 # define STDCALL __attribute__ ((stdcall))
michael@0 134 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */
michael@0 135 # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 136 #endif /* STDCALL */
michael@0 137
michael@0 138 #define ITTAPI CDECL
michael@0 139 #define LIBITTAPI CDECL
michael@0 140
michael@0 141 /* TODO: Temporary for compatibility! */
michael@0 142 #define ITTAPI_CALL CDECL
michael@0 143 #define LIBITTAPI_CALL CDECL
michael@0 144
michael@0 145 #if ITT_PLATFORM==ITT_PLATFORM_WIN
michael@0 146 /* use __forceinline (VC++ specific) */
michael@0 147 #define ITT_INLINE __forceinline
michael@0 148 #define ITT_INLINE_ATTRIBUTE /* nothing */
michael@0 149 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 150 /*
michael@0 151 * Generally, functions are not inlined unless optimization is specified.
michael@0 152 * For functions declared inline, this attribute inlines the function even
michael@0 153 * if no optimization level was specified.
michael@0 154 */
michael@0 155 #ifdef __STRICT_ANSI__
michael@0 156 #define ITT_INLINE static
michael@0 157 #else /* __STRICT_ANSI__ */
michael@0 158 #define ITT_INLINE static inline
michael@0 159 #endif /* __STRICT_ANSI__ */
michael@0 160 #define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline))
michael@0 161 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 162 /** @endcond */
michael@0 163
michael@0 164 #ifndef ITT_ARCH_IA32
michael@0 165 # define ITT_ARCH_IA32 1
michael@0 166 #endif /* ITT_ARCH_IA32 */
michael@0 167
michael@0 168 #ifndef ITT_ARCH_IA32E
michael@0 169 # define ITT_ARCH_IA32E 2
michael@0 170 #endif /* ITT_ARCH_IA32E */
michael@0 171
michael@0 172 #ifndef ITT_ARCH_IA64
michael@0 173 # define ITT_ARCH_IA64 3
michael@0 174 #endif /* ITT_ARCH_IA64 */
michael@0 175
michael@0 176 #ifndef ITT_ARCH
michael@0 177 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
michael@0 178 # define ITT_ARCH ITT_ARCH_IA32E
michael@0 179 # elif defined _M_IA64 || defined __ia64
michael@0 180 # define ITT_ARCH ITT_ARCH_IA64
michael@0 181 # else
michael@0 182 # define ITT_ARCH ITT_ARCH_IA32
michael@0 183 # endif
michael@0 184 #endif
michael@0 185
michael@0 186 #ifdef __cplusplus
michael@0 187 # define ITT_EXTERN_C extern "C"
michael@0 188 #else
michael@0 189 # define ITT_EXTERN_C /* nothing */
michael@0 190 #endif /* __cplusplus */
michael@0 191
michael@0 192 #define ITT_TO_STR_AUX(x) #x
michael@0 193 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
michael@0 194
michael@0 195 #define __ITT_BUILD_ASSERT(expr, suffix) do { \
michael@0 196 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
michael@0 197 __itt_build_check_##suffix[0] = 0; \
michael@0 198 } while(0)
michael@0 199 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
michael@0 200 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
michael@0 201
michael@0 202 #define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
michael@0 203
michael@0 204 /* Replace with snapshot date YYYYMMDD for promotion build. */
michael@0 205 #define API_VERSION_BUILD 20111111
michael@0 206
michael@0 207 #ifndef API_VERSION_NUM
michael@0 208 #define API_VERSION_NUM 0.0.0
michael@0 209 #endif /* API_VERSION_NUM */
michael@0 210
michael@0 211 #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
michael@0 212 " (" ITT_TO_STR(API_VERSION_BUILD) ")"
michael@0 213
michael@0 214 /* OS communication functions */
michael@0 215 #if ITT_PLATFORM==ITT_PLATFORM_WIN
michael@0 216 #include <windows.h>
michael@0 217 typedef HMODULE lib_t;
michael@0 218 typedef DWORD TIDT;
michael@0 219 typedef CRITICAL_SECTION mutex_t;
michael@0 220 #define MUTEX_INITIALIZER { 0 }
michael@0 221 #define strong_alias(name, aliasname) /* empty for Windows */
michael@0 222 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 223 #include <dlfcn.h>
michael@0 224 #if defined(UNICODE) || defined(_UNICODE)
michael@0 225 #include <wchar.h>
michael@0 226 #endif /* UNICODE */
michael@0 227 #ifndef _GNU_SOURCE
michael@0 228 #define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
michael@0 229 #endif /* _GNU_SOURCE */
michael@0 230 #include <pthread.h>
michael@0 231 typedef void* lib_t;
michael@0 232 typedef pthread_t TIDT;
michael@0 233 typedef pthread_mutex_t mutex_t;
michael@0 234 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
michael@0 235 #define _strong_alias(name, aliasname) \
michael@0 236 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
michael@0 237 #define strong_alias(name, aliasname) _strong_alias(name, aliasname)
michael@0 238 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 239
michael@0 240 #if ITT_PLATFORM==ITT_PLATFORM_WIN
michael@0 241 #define __itt_get_proc(lib, name) GetProcAddress(lib, name)
michael@0 242 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
michael@0 243 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
michael@0 244 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
michael@0 245 #define __itt_load_lib(name) LoadLibraryA(name)
michael@0 246 #define __itt_unload_lib(handle) FreeLibrary(handle)
michael@0 247 #define __itt_system_error() (int)GetLastError()
michael@0 248 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
michael@0 249 #define __itt_fstrlen(s) lstrlenA(s)
michael@0 250 #define __itt_fstrcpyn(s1, s2, l) lstrcpynA(s1, s2, l)
michael@0 251 #define __itt_fstrdup(s) _strdup(s)
michael@0 252 #define __itt_thread_id() GetCurrentThreadId()
michael@0 253 #define __itt_thread_yield() SwitchToThread()
michael@0 254 #ifndef ITT_SIMPLE_INIT
michael@0 255 ITT_INLINE long
michael@0 256 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
michael@0 257 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
michael@0 258 {
michael@0 259 return InterlockedIncrement(ptr);
michael@0 260 }
michael@0 261 #endif /* ITT_SIMPLE_INIT */
michael@0 262 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
michael@0 263 #define __itt_get_proc(lib, name) dlsym(lib, name)
michael@0 264 #define __itt_mutex_init(mutex) {\
michael@0 265 pthread_mutexattr_t mutex_attr; \
michael@0 266 int error_code = pthread_mutexattr_init(&mutex_attr); \
michael@0 267 if (error_code) \
michael@0 268 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
michael@0 269 error_code); \
michael@0 270 error_code = pthread_mutexattr_settype(&mutex_attr, \
michael@0 271 PTHREAD_MUTEX_RECURSIVE); \
michael@0 272 if (error_code) \
michael@0 273 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
michael@0 274 error_code); \
michael@0 275 error_code = pthread_mutex_init(mutex, &mutex_attr); \
michael@0 276 if (error_code) \
michael@0 277 __itt_report_error(__itt_error_system, "pthread_mutex_init", \
michael@0 278 error_code); \
michael@0 279 error_code = pthread_mutexattr_destroy(&mutex_attr); \
michael@0 280 if (error_code) \
michael@0 281 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
michael@0 282 error_code); \
michael@0 283 }
michael@0 284 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
michael@0 285 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
michael@0 286 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
michael@0 287 #define __itt_unload_lib(handle) dlclose(handle)
michael@0 288 #define __itt_system_error() errno
michael@0 289 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
michael@0 290 #define __itt_fstrlen(s) strlen(s)
michael@0 291 #define __itt_fstrcpyn(s1, s2, l) strncpy(s1, s2, l)
michael@0 292 #define __itt_fstrdup(s) strdup(s)
michael@0 293 #define __itt_thread_id() pthread_self()
michael@0 294 #define __itt_thread_yield() sched_yield()
michael@0 295 #if ITT_ARCH==ITT_ARCH_IA64
michael@0 296 #ifdef __INTEL_COMPILER
michael@0 297 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
michael@0 298 #else /* __INTEL_COMPILER */
michael@0 299 /* TODO: Add Support for not Intel compilers for IA64 */
michael@0 300 #endif /* __INTEL_COMPILER */
michael@0 301 #else /* ITT_ARCH!=ITT_ARCH_IA64 */
michael@0 302 ITT_INLINE long
michael@0 303 __TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE;
michael@0 304 ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
michael@0 305 {
michael@0 306 long result;
michael@0 307 __asm__ __volatile__("lock\nxadd %0,%1"
michael@0 308 : "=r"(result),"=m"(*(long*)ptr)
michael@0 309 : "0"(addend), "m"(*(long*)ptr)
michael@0 310 : "memory");
michael@0 311 return result;
michael@0 312 }
michael@0 313 #endif /* ITT_ARCH==ITT_ARCH_IA64 */
michael@0 314 #ifndef ITT_SIMPLE_INIT
michael@0 315 ITT_INLINE long
michael@0 316 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
michael@0 317 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
michael@0 318 {
michael@0 319 return __TBB_machine_fetchadd4(ptr, 1) + 1L;
michael@0 320 }
michael@0 321 #endif /* ITT_SIMPLE_INIT */
michael@0 322 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
michael@0 323
michael@0 324 typedef enum {
michael@0 325 __itt_collection_normal = 0,
michael@0 326 __itt_collection_paused = 1
michael@0 327 } __itt_collection_state;
michael@0 328
michael@0 329 typedef enum {
michael@0 330 __itt_thread_normal = 0,
michael@0 331 __itt_thread_ignored = 1
michael@0 332 } __itt_thread_state;
michael@0 333
michael@0 334 #pragma pack(push, 8)
michael@0 335
michael@0 336 typedef struct ___itt_thread_info
michael@0 337 {
michael@0 338 const char* nameA; /*!< Copy of original name in ASCII. */
michael@0 339 #if defined(UNICODE) || defined(_UNICODE)
michael@0 340 const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
michael@0 341 #else /* UNICODE || _UNICODE */
michael@0 342 void* nameW;
michael@0 343 #endif /* UNICODE || _UNICODE */
michael@0 344 TIDT tid;
michael@0 345 __itt_thread_state state; /*!< Thread state (paused or normal) */
michael@0 346 int extra1; /*!< Reserved to the runtime */
michael@0 347 void* extra2; /*!< Reserved to the runtime */
michael@0 348 struct ___itt_thread_info* next;
michael@0 349 } __itt_thread_info;
michael@0 350
michael@0 351 #include "ittnotify_types.h" /* For __itt_group_id definition */
michael@0 352
michael@0 353 typedef struct ___itt_api_info_20101001
michael@0 354 {
michael@0 355 const char* name;
michael@0 356 void** func_ptr;
michael@0 357 void* init_func;
michael@0 358 __itt_group_id group;
michael@0 359 } __itt_api_info_20101001;
michael@0 360
michael@0 361 typedef struct ___itt_api_info
michael@0 362 {
michael@0 363 const char* name;
michael@0 364 void** func_ptr;
michael@0 365 void* init_func;
michael@0 366 void* null_func;
michael@0 367 __itt_group_id group;
michael@0 368 } __itt_api_info;
michael@0 369
michael@0 370 struct ___itt_domain;
michael@0 371 struct ___itt_string_handle;
michael@0 372
michael@0 373 typedef struct ___itt_global
michael@0 374 {
michael@0 375 unsigned char magic[8];
michael@0 376 unsigned long version_major;
michael@0 377 unsigned long version_minor;
michael@0 378 unsigned long version_build;
michael@0 379 volatile long api_initialized;
michael@0 380 volatile long mutex_initialized;
michael@0 381 volatile long atomic_counter;
michael@0 382 mutex_t mutex;
michael@0 383 lib_t lib;
michael@0 384 void* error_handler;
michael@0 385 const char** dll_path_ptr;
michael@0 386 __itt_api_info* api_list_ptr;
michael@0 387 struct ___itt_global* next;
michael@0 388 /* Joinable structures below */
michael@0 389 __itt_thread_info* thread_list;
michael@0 390 struct ___itt_domain* domain_list;
michael@0 391 struct ___itt_string_handle* string_list;
michael@0 392 __itt_collection_state state;
michael@0 393 } __itt_global;
michael@0 394
michael@0 395 #pragma pack(pop)
michael@0 396
michael@0 397 #define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
michael@0 398 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
michael@0 399 if (h != NULL) { \
michael@0 400 h->tid = t; \
michael@0 401 h->nameA = NULL; \
michael@0 402 h->nameW = n ? _wcsdup(n) : NULL; \
michael@0 403 h->state = s; \
michael@0 404 h->extra1 = 0; /* reserved */ \
michael@0 405 h->extra2 = NULL; /* reserved */ \
michael@0 406 h->next = NULL; \
michael@0 407 if (h_tail == NULL) \
michael@0 408 (gptr)->thread_list = h; \
michael@0 409 else \
michael@0 410 h_tail->next = h; \
michael@0 411 } \
michael@0 412 }
michael@0 413
michael@0 414 #define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
michael@0 415 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
michael@0 416 if (h != NULL) { \
michael@0 417 h->tid = t; \
michael@0 418 h->nameA = n ? __itt_fstrdup(n) : NULL; \
michael@0 419 h->nameW = NULL; \
michael@0 420 h->state = s; \
michael@0 421 h->extra1 = 0; /* reserved */ \
michael@0 422 h->extra2 = NULL; /* reserved */ \
michael@0 423 h->next = NULL; \
michael@0 424 if (h_tail == NULL) \
michael@0 425 (gptr)->thread_list = h; \
michael@0 426 else \
michael@0 427 h_tail->next = h; \
michael@0 428 } \
michael@0 429 }
michael@0 430
michael@0 431 #define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
michael@0 432 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
michael@0 433 if (h != NULL) { \
michael@0 434 h->flags = 0; /* domain is disabled by default */ \
michael@0 435 h->nameA = NULL; \
michael@0 436 h->nameW = name ? _wcsdup(name) : NULL; \
michael@0 437 h->extra1 = 0; /* reserved */ \
michael@0 438 h->extra2 = NULL; /* reserved */ \
michael@0 439 h->next = NULL; \
michael@0 440 if (h_tail == NULL) \
michael@0 441 (gptr)->domain_list = h; \
michael@0 442 else \
michael@0 443 h_tail->next = h; \
michael@0 444 } \
michael@0 445 }
michael@0 446
michael@0 447 #define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
michael@0 448 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
michael@0 449 if (h != NULL) { \
michael@0 450 h->flags = 0; /* domain is disabled by default */ \
michael@0 451 h->nameA = name ? __itt_fstrdup(name) : NULL; \
michael@0 452 h->nameW = NULL; \
michael@0 453 h->extra1 = 0; /* reserved */ \
michael@0 454 h->extra2 = NULL; /* reserved */ \
michael@0 455 h->next = NULL; \
michael@0 456 if (h_tail == NULL) \
michael@0 457 (gptr)->domain_list = h; \
michael@0 458 else \
michael@0 459 h_tail->next = h; \
michael@0 460 } \
michael@0 461 }
michael@0 462
michael@0 463 #define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
michael@0 464 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
michael@0 465 if (h != NULL) { \
michael@0 466 h->strA = NULL; \
michael@0 467 h->strW = name ? _wcsdup(name) : NULL; \
michael@0 468 h->extra1 = 0; /* reserved */ \
michael@0 469 h->extra2 = NULL; /* reserved */ \
michael@0 470 h->next = NULL; \
michael@0 471 if (h_tail == NULL) \
michael@0 472 (gptr)->string_list = h; \
michael@0 473 else \
michael@0 474 h_tail->next = h; \
michael@0 475 } \
michael@0 476 }
michael@0 477
michael@0 478 #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
michael@0 479 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
michael@0 480 if (h != NULL) { \
michael@0 481 h->strA = name ? __itt_fstrdup(name) : NULL; \
michael@0 482 h->strW = NULL; \
michael@0 483 h->extra1 = 0; /* reserved */ \
michael@0 484 h->extra2 = NULL; /* reserved */ \
michael@0 485 h->next = NULL; \
michael@0 486 if (h_tail == NULL) \
michael@0 487 (gptr)->string_list = h; \
michael@0 488 else \
michael@0 489 h_tail->next = h; \
michael@0 490 } \
michael@0 491 }
michael@0 492
michael@0 493 #endif /* _ITTNOTIFY_CONFIG_H_ */

mercurial