js/src/vtune/ittnotify_config.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/vtune/ittnotify_config.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,493 @@
     1.4 +/*
     1.5 +  This file is provided under a dual BSD/GPLv2 license.  When using or
     1.6 +  redistributing this file, you may do so under either license.
     1.7 +
     1.8 +  GPL LICENSE SUMMARY
     1.9 +
    1.10 +  Copyright (c) 2005-2012 Intel Corporation. All rights reserved.
    1.11 +
    1.12 +  This program is free software; you can redistribute it and/or modify
    1.13 +  it under the terms of version 2 of the GNU General Public License as
    1.14 +  published by the Free Software Foundation.
    1.15 +
    1.16 +  This program is distributed in the hope that it will be useful, but
    1.17 +  WITHOUT ANY WARRANTY; without even the implied warranty of
    1.18 +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.19 +  General Public License for more details.
    1.20 +
    1.21 +  You should have received a copy of the GNU General Public License
    1.22 +  along with this program; if not, write to the Free Software
    1.23 +  Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    1.24 +  The full GNU General Public License is included in this distribution
    1.25 +  in the file called LICENSE.GPL.
    1.26 +
    1.27 +  Contact Information:
    1.28 +  http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
    1.29 +
    1.30 +  BSD LICENSE
    1.31 +
    1.32 +  Copyright (c) 2005-2012 Intel Corporation. All rights reserved.
    1.33 +  All rights reserved.
    1.34 +
    1.35 +  Redistribution and use in source and binary forms, with or without
    1.36 +  modification, are permitted provided that the following conditions
    1.37 +  are met:
    1.38 +
    1.39 +    * Redistributions of source code must retain the above copyright
    1.40 +      notice, this list of conditions and the following disclaimer.
    1.41 +    * Redistributions in binary form must reproduce the above copyright
    1.42 +      notice, this list of conditions and the following disclaimer in
    1.43 +      the documentation and/or other materials provided with the
    1.44 +      distribution.
    1.45 +    * Neither the name of Intel Corporation nor the names of its
    1.46 +      contributors may be used to endorse or promote products derived
    1.47 +      from this software without specific prior written permission.
    1.48 +
    1.49 +  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.50 +  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.51 +  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.52 +  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.53 +  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.54 +  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.55 +  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.56 +  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.57 +  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.58 +  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.59 +  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.60 +*/
    1.61 +#ifndef _ITTNOTIFY_CONFIG_H_
    1.62 +#define _ITTNOTIFY_CONFIG_H_
    1.63 +
    1.64 +/** @cond exclude_from_documentation */
    1.65 +#ifndef ITT_OS_WIN
    1.66 +#  define ITT_OS_WIN   1
    1.67 +#endif /* ITT_OS_WIN */
    1.68 +
    1.69 +#ifndef ITT_OS_LINUX
    1.70 +#  define ITT_OS_LINUX 2
    1.71 +#endif /* ITT_OS_LINUX */
    1.72 +
    1.73 +#ifndef ITT_OS_MAC
    1.74 +#  define ITT_OS_MAC   3
    1.75 +#endif /* ITT_OS_MAC */
    1.76 +
    1.77 +#ifndef ITT_OS
    1.78 +#  if defined WIN32 || defined _WIN32
    1.79 +#    define ITT_OS ITT_OS_WIN
    1.80 +#  elif defined( __APPLE__ ) && defined( __MACH__ )
    1.81 +#    define ITT_OS ITT_OS_MAC
    1.82 +#  else
    1.83 +#    define ITT_OS ITT_OS_LINUX
    1.84 +#  endif
    1.85 +#endif /* ITT_OS */
    1.86 +
    1.87 +#ifndef ITT_PLATFORM_WIN
    1.88 +#  define ITT_PLATFORM_WIN 1
    1.89 +#endif /* ITT_PLATFORM_WIN */
    1.90 +
    1.91 +#ifndef ITT_PLATFORM_POSIX
    1.92 +#  define ITT_PLATFORM_POSIX 2
    1.93 +#endif /* ITT_PLATFORM_POSIX */
    1.94 +
    1.95 +#ifndef ITT_PLATFORM
    1.96 +#  if ITT_OS==ITT_OS_WIN
    1.97 +#    define ITT_PLATFORM ITT_PLATFORM_WIN
    1.98 +#  else
    1.99 +#    define ITT_PLATFORM ITT_PLATFORM_POSIX
   1.100 +#  endif /* _WIN32 */
   1.101 +#endif /* ITT_PLATFORM */
   1.102 +
   1.103 +#if defined(_UNICODE) && !defined(UNICODE)
   1.104 +#define UNICODE
   1.105 +#endif
   1.106 +
   1.107 +#include <stddef.h>
   1.108 +#if ITT_PLATFORM==ITT_PLATFORM_WIN
   1.109 +#include <tchar.h>
   1.110 +#else  /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.111 +#include <stdint.h>
   1.112 +#if defined(UNICODE) || defined(_UNICODE)
   1.113 +#include <wchar.h>
   1.114 +#endif /* UNICODE || _UNICODE */
   1.115 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.116 +
   1.117 +#ifndef CDECL
   1.118 +#  if ITT_PLATFORM==ITT_PLATFORM_WIN
   1.119 +#    define CDECL __cdecl
   1.120 +#  else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.121 +#    if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
   1.122 +#      define CDECL /* not actual on x86_64 platform */
   1.123 +#    else  /* _M_X64 || _M_AMD64 || __x86_64__ */
   1.124 +#      define CDECL __attribute__ ((cdecl))
   1.125 +#    endif /* _M_X64 || _M_AMD64 || __x86_64__ */
   1.126 +#  endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.127 +#endif /* CDECL */
   1.128 +
   1.129 +#ifndef STDCALL
   1.130 +#  if ITT_PLATFORM==ITT_PLATFORM_WIN
   1.131 +#    define STDCALL __stdcall
   1.132 +#  else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.133 +#    if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
   1.134 +#      define STDCALL /* not supported on x86_64 platform */
   1.135 +#    else  /* _M_X64 || _M_AMD64 || __x86_64__ */
   1.136 +#      define STDCALL __attribute__ ((stdcall))
   1.137 +#    endif /* _M_X64 || _M_AMD64 || __x86_64__ */
   1.138 +#  endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.139 +#endif /* STDCALL */
   1.140 +
   1.141 +#define ITTAPI    CDECL
   1.142 +#define LIBITTAPI CDECL
   1.143 +
   1.144 +/* TODO: Temporary for compatibility! */
   1.145 +#define ITTAPI_CALL    CDECL
   1.146 +#define LIBITTAPI_CALL CDECL
   1.147 +
   1.148 +#if ITT_PLATFORM==ITT_PLATFORM_WIN
   1.149 +/* use __forceinline (VC++ specific) */
   1.150 +#define ITT_INLINE           __forceinline
   1.151 +#define ITT_INLINE_ATTRIBUTE /* nothing */
   1.152 +#else  /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.153 +/*
   1.154 + * Generally, functions are not inlined unless optimization is specified.
   1.155 + * For functions declared inline, this attribute inlines the function even
   1.156 + * if no optimization level was specified.
   1.157 + */
   1.158 +#ifdef __STRICT_ANSI__
   1.159 +#define ITT_INLINE           static
   1.160 +#else  /* __STRICT_ANSI__ */
   1.161 +#define ITT_INLINE           static inline
   1.162 +#endif /* __STRICT_ANSI__ */
   1.163 +#define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline))
   1.164 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.165 +/** @endcond */
   1.166 +
   1.167 +#ifndef ITT_ARCH_IA32
   1.168 +#  define ITT_ARCH_IA32  1
   1.169 +#endif /* ITT_ARCH_IA32 */
   1.170 +
   1.171 +#ifndef ITT_ARCH_IA32E
   1.172 +#  define ITT_ARCH_IA32E 2
   1.173 +#endif /* ITT_ARCH_IA32E */
   1.174 +
   1.175 +#ifndef ITT_ARCH_IA64
   1.176 +#  define ITT_ARCH_IA64  3
   1.177 +#endif /* ITT_ARCH_IA64 */
   1.178 +
   1.179 +#ifndef ITT_ARCH
   1.180 +#  if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
   1.181 +#    define ITT_ARCH ITT_ARCH_IA32E
   1.182 +#  elif defined _M_IA64 || defined __ia64
   1.183 +#    define ITT_ARCH ITT_ARCH_IA64
   1.184 +#  else
   1.185 +#    define ITT_ARCH ITT_ARCH_IA32
   1.186 +#  endif
   1.187 +#endif
   1.188 +
   1.189 +#ifdef __cplusplus
   1.190 +#  define ITT_EXTERN_C extern "C"
   1.191 +#else
   1.192 +#  define ITT_EXTERN_C /* nothing */
   1.193 +#endif /* __cplusplus */
   1.194 +
   1.195 +#define ITT_TO_STR_AUX(x) #x
   1.196 +#define ITT_TO_STR(x)     ITT_TO_STR_AUX(x)
   1.197 +
   1.198 +#define __ITT_BUILD_ASSERT(expr, suffix) do { \
   1.199 +    static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
   1.200 +    __itt_build_check_##suffix[0] = 0; \
   1.201 +} while(0)
   1.202 +#define _ITT_BUILD_ASSERT(expr, suffix)  __ITT_BUILD_ASSERT((expr), suffix)
   1.203 +#define ITT_BUILD_ASSERT(expr)           _ITT_BUILD_ASSERT((expr), __LINE__)
   1.204 +
   1.205 +#define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
   1.206 +
   1.207 +/* Replace with snapshot date YYYYMMDD for promotion build. */
   1.208 +#define API_VERSION_BUILD    20111111
   1.209 +
   1.210 +#ifndef API_VERSION_NUM
   1.211 +#define API_VERSION_NUM 0.0.0
   1.212 +#endif /* API_VERSION_NUM */
   1.213 +
   1.214 +#define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
   1.215 +                                " (" ITT_TO_STR(API_VERSION_BUILD) ")"
   1.216 +
   1.217 +/* OS communication functions */
   1.218 +#if ITT_PLATFORM==ITT_PLATFORM_WIN
   1.219 +#include <windows.h>
   1.220 +typedef HMODULE           lib_t;
   1.221 +typedef DWORD             TIDT;
   1.222 +typedef CRITICAL_SECTION  mutex_t;
   1.223 +#define MUTEX_INITIALIZER { 0 }
   1.224 +#define strong_alias(name, aliasname) /* empty for Windows */
   1.225 +#else  /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.226 +#include <dlfcn.h>
   1.227 +#if defined(UNICODE) || defined(_UNICODE)
   1.228 +#include <wchar.h>
   1.229 +#endif /* UNICODE */
   1.230 +#ifndef _GNU_SOURCE
   1.231 +#define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
   1.232 +#endif /* _GNU_SOURCE */
   1.233 +#include <pthread.h>
   1.234 +typedef void*             lib_t;
   1.235 +typedef pthread_t         TIDT;
   1.236 +typedef pthread_mutex_t   mutex_t;
   1.237 +#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
   1.238 +#define _strong_alias(name, aliasname) \
   1.239 +            extern __typeof (name) aliasname __attribute__ ((alias (#name)));
   1.240 +#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
   1.241 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.242 +
   1.243 +#if ITT_PLATFORM==ITT_PLATFORM_WIN
   1.244 +#define __itt_get_proc(lib, name) GetProcAddress(lib, name)
   1.245 +#define __itt_mutex_init(mutex)   InitializeCriticalSection(mutex)
   1.246 +#define __itt_mutex_lock(mutex)   EnterCriticalSection(mutex)
   1.247 +#define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
   1.248 +#define __itt_load_lib(name)      LoadLibraryA(name)
   1.249 +#define __itt_unload_lib(handle)  FreeLibrary(handle)
   1.250 +#define __itt_system_error()      (int)GetLastError()
   1.251 +#define __itt_fstrcmp(s1, s2)     lstrcmpA(s1, s2)
   1.252 +#define __itt_fstrlen(s)          lstrlenA(s)
   1.253 +#define __itt_fstrcpyn(s1, s2, l) lstrcpynA(s1, s2, l)
   1.254 +#define __itt_fstrdup(s)          _strdup(s)
   1.255 +#define __itt_thread_id()         GetCurrentThreadId()
   1.256 +#define __itt_thread_yield()      SwitchToThread()
   1.257 +#ifndef ITT_SIMPLE_INIT
   1.258 +ITT_INLINE long
   1.259 +__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
   1.260 +ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
   1.261 +{
   1.262 +    return InterlockedIncrement(ptr);
   1.263 +}
   1.264 +#endif /* ITT_SIMPLE_INIT */
   1.265 +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
   1.266 +#define __itt_get_proc(lib, name) dlsym(lib, name)
   1.267 +#define __itt_mutex_init(mutex)   {\
   1.268 +    pthread_mutexattr_t mutex_attr;                                         \
   1.269 +    int error_code = pthread_mutexattr_init(&mutex_attr);                   \
   1.270 +    if (error_code)                                                         \
   1.271 +        __itt_report_error(__itt_error_system, "pthread_mutexattr_init",    \
   1.272 +                           error_code);                                     \
   1.273 +    error_code = pthread_mutexattr_settype(&mutex_attr,                     \
   1.274 +                                           PTHREAD_MUTEX_RECURSIVE);        \
   1.275 +    if (error_code)                                                         \
   1.276 +        __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
   1.277 +                           error_code);                                     \
   1.278 +    error_code = pthread_mutex_init(mutex, &mutex_attr);                    \
   1.279 +    if (error_code)                                                         \
   1.280 +        __itt_report_error(__itt_error_system, "pthread_mutex_init",        \
   1.281 +                           error_code);                                     \
   1.282 +    error_code = pthread_mutexattr_destroy(&mutex_attr);                    \
   1.283 +    if (error_code)                                                         \
   1.284 +        __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
   1.285 +                           error_code);                                     \
   1.286 +}
   1.287 +#define __itt_mutex_lock(mutex)   pthread_mutex_lock(mutex)
   1.288 +#define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
   1.289 +#define __itt_load_lib(name)      dlopen(name, RTLD_LAZY)
   1.290 +#define __itt_unload_lib(handle)  dlclose(handle)
   1.291 +#define __itt_system_error()      errno
   1.292 +#define __itt_fstrcmp(s1, s2)     strcmp(s1, s2)
   1.293 +#define __itt_fstrlen(s)          strlen(s)
   1.294 +#define __itt_fstrcpyn(s1, s2, l) strncpy(s1, s2, l)
   1.295 +#define __itt_fstrdup(s)          strdup(s)
   1.296 +#define __itt_thread_id()         pthread_self()
   1.297 +#define __itt_thread_yield()      sched_yield()
   1.298 +#if ITT_ARCH==ITT_ARCH_IA64
   1.299 +#ifdef __INTEL_COMPILER
   1.300 +#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
   1.301 +#else  /* __INTEL_COMPILER */
   1.302 +/* TODO: Add Support for not Intel compilers for IA64 */
   1.303 +#endif /* __INTEL_COMPILER */
   1.304 +#else /* ITT_ARCH!=ITT_ARCH_IA64 */
   1.305 +ITT_INLINE long
   1.306 +__TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE;
   1.307 +ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
   1.308 +{
   1.309 +    long result;
   1.310 +    __asm__ __volatile__("lock\nxadd %0,%1"
   1.311 +                          : "=r"(result),"=m"(*(long*)ptr)
   1.312 +                          : "0"(addend), "m"(*(long*)ptr)
   1.313 +                          : "memory");
   1.314 +    return result;
   1.315 +}
   1.316 +#endif /* ITT_ARCH==ITT_ARCH_IA64 */
   1.317 +#ifndef ITT_SIMPLE_INIT
   1.318 +ITT_INLINE long
   1.319 +__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
   1.320 +ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
   1.321 +{
   1.322 +    return __TBB_machine_fetchadd4(ptr, 1) + 1L;
   1.323 +}
   1.324 +#endif /* ITT_SIMPLE_INIT */
   1.325 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
   1.326 +
   1.327 +typedef enum {
   1.328 +    __itt_collection_normal = 0,
   1.329 +    __itt_collection_paused = 1
   1.330 +} __itt_collection_state;
   1.331 +
   1.332 +typedef enum {
   1.333 +    __itt_thread_normal  = 0,
   1.334 +    __itt_thread_ignored = 1
   1.335 +} __itt_thread_state;
   1.336 +
   1.337 +#pragma pack(push, 8)
   1.338 +
   1.339 +typedef struct ___itt_thread_info
   1.340 +{
   1.341 +    const char* nameA; /*!< Copy of original name in ASCII. */
   1.342 +#if defined(UNICODE) || defined(_UNICODE)
   1.343 +    const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
   1.344 +#else  /* UNICODE || _UNICODE */
   1.345 +    void* nameW;
   1.346 +#endif /* UNICODE || _UNICODE */
   1.347 +    TIDT               tid;
   1.348 +    __itt_thread_state state;   /*!< Thread state (paused or normal) */
   1.349 +    int                extra1;  /*!< Reserved to the runtime */
   1.350 +    void*              extra2;  /*!< Reserved to the runtime */
   1.351 +    struct ___itt_thread_info* next;
   1.352 +} __itt_thread_info;
   1.353 +
   1.354 +#include "ittnotify_types.h" /* For __itt_group_id definition */
   1.355 +
   1.356 +typedef struct ___itt_api_info_20101001
   1.357 +{
   1.358 +    const char*    name;
   1.359 +    void**         func_ptr;
   1.360 +    void*          init_func;
   1.361 +    __itt_group_id group;
   1.362 +}  __itt_api_info_20101001;
   1.363 +
   1.364 +typedef struct ___itt_api_info
   1.365 +{
   1.366 +    const char*    name;
   1.367 +    void**         func_ptr;
   1.368 +    void*          init_func;
   1.369 +    void*          null_func;
   1.370 +    __itt_group_id group;
   1.371 +}  __itt_api_info;
   1.372 +
   1.373 +struct ___itt_domain;
   1.374 +struct ___itt_string_handle;
   1.375 +
   1.376 +typedef struct ___itt_global
   1.377 +{
   1.378 +    unsigned char          magic[8];
   1.379 +    unsigned long          version_major;
   1.380 +    unsigned long          version_minor;
   1.381 +    unsigned long          version_build;
   1.382 +    volatile long          api_initialized;
   1.383 +    volatile long          mutex_initialized;
   1.384 +    volatile long          atomic_counter;
   1.385 +    mutex_t                mutex;
   1.386 +    lib_t                  lib;
   1.387 +    void*                  error_handler;
   1.388 +    const char**           dll_path_ptr;
   1.389 +    __itt_api_info*        api_list_ptr;
   1.390 +    struct ___itt_global*  next;
   1.391 +    /* Joinable structures below */
   1.392 +    __itt_thread_info*     thread_list;
   1.393 +    struct ___itt_domain*  domain_list;
   1.394 +    struct ___itt_string_handle* string_list;
   1.395 +    __itt_collection_state state;
   1.396 +} __itt_global;
   1.397 +
   1.398 +#pragma pack(pop)
   1.399 +
   1.400 +#define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
   1.401 +    h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
   1.402 +    if (h != NULL) { \
   1.403 +        h->tid    = t; \
   1.404 +        h->nameA  = NULL; \
   1.405 +        h->nameW  = n ? _wcsdup(n) : NULL; \
   1.406 +        h->state  = s; \
   1.407 +        h->extra1 = 0;    /* reserved */ \
   1.408 +        h->extra2 = NULL; /* reserved */ \
   1.409 +        h->next   = NULL; \
   1.410 +        if (h_tail == NULL) \
   1.411 +            (gptr)->thread_list = h; \
   1.412 +        else \
   1.413 +            h_tail->next = h; \
   1.414 +    } \
   1.415 +}
   1.416 +
   1.417 +#define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
   1.418 +    h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
   1.419 +    if (h != NULL) { \
   1.420 +        h->tid    = t; \
   1.421 +        h->nameA  = n ? __itt_fstrdup(n) : NULL; \
   1.422 +        h->nameW  = NULL; \
   1.423 +        h->state  = s; \
   1.424 +        h->extra1 = 0;    /* reserved */ \
   1.425 +        h->extra2 = NULL; /* reserved */ \
   1.426 +        h->next   = NULL; \
   1.427 +        if (h_tail == NULL) \
   1.428 +            (gptr)->thread_list = h; \
   1.429 +        else \
   1.430 +            h_tail->next = h; \
   1.431 +    } \
   1.432 +}
   1.433 +
   1.434 +#define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
   1.435 +    h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
   1.436 +    if (h != NULL) { \
   1.437 +        h->flags  = 0;    /* domain is disabled by default */ \
   1.438 +        h->nameA  = NULL; \
   1.439 +        h->nameW  = name ? _wcsdup(name) : NULL; \
   1.440 +        h->extra1 = 0;    /* reserved */ \
   1.441 +        h->extra2 = NULL; /* reserved */ \
   1.442 +        h->next   = NULL; \
   1.443 +        if (h_tail == NULL) \
   1.444 +            (gptr)->domain_list = h; \
   1.445 +        else \
   1.446 +            h_tail->next = h; \
   1.447 +    } \
   1.448 +}
   1.449 +
   1.450 +#define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
   1.451 +    h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
   1.452 +    if (h != NULL) { \
   1.453 +        h->flags  = 0;    /* domain is disabled by default */ \
   1.454 +        h->nameA  = name ? __itt_fstrdup(name) : NULL; \
   1.455 +        h->nameW  = NULL; \
   1.456 +        h->extra1 = 0;    /* reserved */ \
   1.457 +        h->extra2 = NULL; /* reserved */ \
   1.458 +        h->next   = NULL; \
   1.459 +        if (h_tail == NULL) \
   1.460 +            (gptr)->domain_list = h; \
   1.461 +        else \
   1.462 +            h_tail->next = h; \
   1.463 +    } \
   1.464 +}
   1.465 +
   1.466 +#define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
   1.467 +    h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
   1.468 +    if (h != NULL) { \
   1.469 +        h->strA   = NULL; \
   1.470 +        h->strW   = name ? _wcsdup(name) : NULL; \
   1.471 +        h->extra1 = 0;    /* reserved */ \
   1.472 +        h->extra2 = NULL; /* reserved */ \
   1.473 +        h->next   = NULL; \
   1.474 +        if (h_tail == NULL) \
   1.475 +            (gptr)->string_list = h; \
   1.476 +        else \
   1.477 +            h_tail->next = h; \
   1.478 +    } \
   1.479 +}
   1.480 +
   1.481 +#define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
   1.482 +    h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
   1.483 +    if (h != NULL) { \
   1.484 +        h->strA   = name ? __itt_fstrdup(name) : NULL; \
   1.485 +        h->strW   = NULL; \
   1.486 +        h->extra1 = 0;    /* reserved */ \
   1.487 +        h->extra2 = NULL; /* reserved */ \
   1.488 +        h->next   = NULL; \
   1.489 +        if (h_tail == NULL) \
   1.490 +            (gptr)->string_list = h; \
   1.491 +        else \
   1.492 +            h_tail->next = h; \
   1.493 +    } \
   1.494 +}
   1.495 +
   1.496 +#endif /* _ITTNOTIFY_CONFIG_H_ */

mercurial