1345153Sdim 2345153Sdim//===----------------------------------------------------------------------===// 3345153Sdim// 4353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5353358Sdim// See https://llvm.org/LICENSE.txt for license information. 6353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7345153Sdim// 8345153Sdim//===----------------------------------------------------------------------===// 9345153Sdim 10345153Sdim#ifndef _LEGACY_ITTNOTIFY_H_ 11345153Sdim#define _LEGACY_ITTNOTIFY_H_ 12345153Sdim 13345153Sdim/** 14345153Sdim * @file 15345153Sdim * @brief Legacy User API functions and types 16345153Sdim */ 17345153Sdim 18345153Sdim/** @cond exclude_from_documentation */ 19345153Sdim#ifndef ITT_OS_WIN 20345153Sdim# define ITT_OS_WIN 1 21345153Sdim#endif /* ITT_OS_WIN */ 22345153Sdim 23345153Sdim#ifndef ITT_OS_LINUX 24345153Sdim# define ITT_OS_LINUX 2 25345153Sdim#endif /* ITT_OS_LINUX */ 26345153Sdim 27345153Sdim#ifndef ITT_OS_MAC 28345153Sdim# define ITT_OS_MAC 3 29345153Sdim#endif /* ITT_OS_MAC */ 30345153Sdim 31345153Sdim#ifndef ITT_OS_FREEBSD 32345153Sdim# define ITT_OS_FREEBSD 4 33345153Sdim#endif /* ITT_OS_FREEBSD */ 34345153Sdim 35345153Sdim#ifndef ITT_OS 36345153Sdim# if defined WIN32 || defined _WIN32 37345153Sdim# define ITT_OS ITT_OS_WIN 38345153Sdim# elif defined( __APPLE__ ) && defined( __MACH__ ) 39345153Sdim# define ITT_OS ITT_OS_MAC 40345153Sdim# elif defined( __FreeBSD__ ) 41345153Sdim# define ITT_OS ITT_OS_FREEBSD 42345153Sdim# else 43345153Sdim# define ITT_OS ITT_OS_LINUX 44345153Sdim# endif 45345153Sdim#endif /* ITT_OS */ 46345153Sdim 47345153Sdim#ifndef ITT_PLATFORM_WIN 48345153Sdim# define ITT_PLATFORM_WIN 1 49345153Sdim#endif /* ITT_PLATFORM_WIN */ 50345153Sdim 51345153Sdim#ifndef ITT_PLATFORM_POSIX 52345153Sdim# define ITT_PLATFORM_POSIX 2 53345153Sdim#endif /* ITT_PLATFORM_POSIX */ 54345153Sdim 55345153Sdim#ifndef ITT_PLATFORM_MAC 56345153Sdim# define ITT_PLATFORM_MAC 3 57345153Sdim#endif /* ITT_PLATFORM_MAC */ 58345153Sdim 59345153Sdim#ifndef ITT_PLATFORM_FREEBSD 60345153Sdim# define ITT_PLATFORM_FREEBSD 4 61345153Sdim#endif /* ITT_PLATFORM_FREEBSD */ 62345153Sdim 63345153Sdim#ifndef ITT_PLATFORM 64345153Sdim# if ITT_OS==ITT_OS_WIN 65345153Sdim# define ITT_PLATFORM ITT_PLATFORM_WIN 66345153Sdim# elif ITT_OS==ITT_OS_MAC 67345153Sdim# define ITT_PLATFORM ITT_PLATFORM_MAC 68345153Sdim# elif ITT_OS==ITT_OS_FREEBSD 69345153Sdim# define ITT_PLATFORM ITT_PLATFORM_FREEBSD 70345153Sdim# else 71345153Sdim# define ITT_PLATFORM ITT_PLATFORM_POSIX 72345153Sdim# endif 73345153Sdim#endif /* ITT_PLATFORM */ 74345153Sdim 75345153Sdim#if defined(_UNICODE) && !defined(UNICODE) 76345153Sdim#define UNICODE 77345153Sdim#endif 78345153Sdim 79345153Sdim#include <stddef.h> 80345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 81345153Sdim#include <tchar.h> 82345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 83345153Sdim#include <stdint.h> 84345153Sdim#if defined(UNICODE) || defined(_UNICODE) 85345153Sdim#include <wchar.h> 86345153Sdim#endif /* UNICODE || _UNICODE */ 87345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 88345153Sdim 89345153Sdim#ifndef ITTAPI_CDECL 90345153Sdim# if ITT_PLATFORM==ITT_PLATFORM_WIN 91345153Sdim# define ITTAPI_CDECL __cdecl 92345153Sdim# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 93345153Sdim# if defined _M_IX86 || defined __i386__ 94345153Sdim# define ITTAPI_CDECL __attribute__ ((cdecl)) 95345153Sdim# else /* _M_IX86 || __i386__ */ 96345153Sdim# define ITTAPI_CDECL /* actual only on x86 platform */ 97345153Sdim# endif /* _M_IX86 || __i386__ */ 98345153Sdim# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 99345153Sdim#endif /* ITTAPI_CDECL */ 100345153Sdim 101345153Sdim#ifndef STDCALL 102345153Sdim# if ITT_PLATFORM==ITT_PLATFORM_WIN 103345153Sdim# define STDCALL __stdcall 104345153Sdim# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 105345153Sdim# if defined _M_IX86 || defined __i386__ 106345153Sdim# define STDCALL __attribute__ ((stdcall)) 107345153Sdim# else /* _M_IX86 || __i386__ */ 108345153Sdim# define STDCALL /* supported only on x86 platform */ 109345153Sdim# endif /* _M_IX86 || __i386__ */ 110345153Sdim# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 111345153Sdim#endif /* STDCALL */ 112345153Sdim 113345153Sdim#define ITTAPI ITTAPI_CDECL 114345153Sdim#define LIBITTAPI ITTAPI_CDECL 115345153Sdim 116345153Sdim/* TODO: Temporary for compatibility! */ 117345153Sdim#define ITTAPI_CALL ITTAPI_CDECL 118345153Sdim#define LIBITTAPI_CALL ITTAPI_CDECL 119345153Sdim 120345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 121345153Sdim/* use __forceinline (VC++ specific) */ 122345153Sdim#define ITT_INLINE __forceinline 123345153Sdim#define ITT_INLINE_ATTRIBUTE /* nothing */ 124345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 125345153Sdim/* 126345153Sdim * Generally, functions are not inlined unless optimization is specified. 127345153Sdim * For functions declared inline, this attribute inlines the function even 128345153Sdim * if no optimization level was specified. 129345153Sdim */ 130345153Sdim#ifdef __STRICT_ANSI__ 131345153Sdim#define ITT_INLINE static 132345153Sdim#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) 133345153Sdim#else /* __STRICT_ANSI__ */ 134345153Sdim#define ITT_INLINE static inline 135345153Sdim#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) 136345153Sdim#endif /* __STRICT_ANSI__ */ 137345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 138345153Sdim/** @endcond */ 139345153Sdim 140345153Sdim/** @cond exclude_from_documentation */ 141345153Sdim/* Helper macro for joining tokens */ 142345153Sdim#define ITT_JOIN_AUX(p,n) p##n 143345153Sdim#define ITT_JOIN(p,n) ITT_JOIN_AUX(p,n) 144345153Sdim 145345153Sdim#ifdef ITT_MAJOR 146345153Sdim#undef ITT_MAJOR 147345153Sdim#endif 148345153Sdim#ifdef ITT_MINOR 149345153Sdim#undef ITT_MINOR 150345153Sdim#endif 151345153Sdim#define ITT_MAJOR 3 152345153Sdim#define ITT_MINOR 0 153345153Sdim 154345153Sdim/* Standard versioning of a token with major and minor version numbers */ 155345153Sdim#define ITT_VERSIONIZE(x) \ 156345153Sdim ITT_JOIN(x, \ 157345153Sdim ITT_JOIN(_, \ 158345153Sdim ITT_JOIN(ITT_MAJOR, \ 159345153Sdim ITT_JOIN(_, ITT_MINOR)))) 160345153Sdim 161345153Sdim#ifndef INTEL_ITTNOTIFY_PREFIX 162345153Sdim# define INTEL_ITTNOTIFY_PREFIX __itt_ 163345153Sdim#endif /* INTEL_ITTNOTIFY_PREFIX */ 164345153Sdim#ifndef INTEL_ITTNOTIFY_POSTFIX 165345153Sdim# define INTEL_ITTNOTIFY_POSTFIX _ptr_ 166345153Sdim#endif /* INTEL_ITTNOTIFY_POSTFIX */ 167345153Sdim 168345153Sdim#define ITTNOTIFY_NAME_AUX(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n) 169345153Sdim#define ITTNOTIFY_NAME(n) ITT_VERSIONIZE(ITTNOTIFY_NAME_AUX(ITT_JOIN(n,INTEL_ITTNOTIFY_POSTFIX))) 170345153Sdim 171345153Sdim#define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) 172345153Sdim#define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) 173345153Sdim 174345153Sdim#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) 175345153Sdim#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) 176345153Sdim#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) 177345153Sdim#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) 178345153Sdim#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) 179345153Sdim#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) 180345153Sdim#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) 181345153Sdim#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) 182345153Sdim#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) 183345153Sdim#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) 184345153Sdim#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) 185345153Sdim#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) 186345153Sdim#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) 187345153Sdim#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) 188345153Sdim 189345153Sdim#ifdef ITT_STUB 190345153Sdim#undef ITT_STUB 191345153Sdim#endif 192345153Sdim#ifdef ITT_STUBV 193345153Sdim#undef ITT_STUBV 194345153Sdim#endif 195345153Sdim#define ITT_STUBV(api,type,name,args) \ 196345153Sdim typedef type (api* ITT_JOIN(ITTNOTIFY_NAME(name),_t)) args; \ 197345153Sdim extern ITT_JOIN(ITTNOTIFY_NAME(name),_t) ITTNOTIFY_NAME(name); 198345153Sdim#define ITT_STUB ITT_STUBV 199345153Sdim/** @endcond */ 200345153Sdim 201345153Sdim#ifdef __cplusplus 202345153Sdimextern "C" { 203345153Sdim#endif /* __cplusplus */ 204345153Sdim 205345153Sdim/** 206345153Sdim * @defgroup legacy Legacy API 207345153Sdim * @{ 208345153Sdim * @} 209345153Sdim */ 210345153Sdim 211345153Sdim/** 212345153Sdim * @defgroup legacy_control Collection Control 213345153Sdim * @ingroup legacy 214345153Sdim * General behavior: application continues to run, but no profiling information is being collected 215345153Sdim * 216345153Sdim * Pausing occurs not only for the current thread but for all process as well as spawned processes 217345153Sdim * - Intel(R) Parallel Inspector and Intel(R) Inspector XE: 218345153Sdim * - Does not analyze or report errors that involve memory access. 219345153Sdim * - Other errors are reported as usual. Pausing data collection in 220345153Sdim * Intel(R) Parallel Inspector and Intel(R) Inspector XE 221345153Sdim * only pauses tracing and analyzing memory access. 222345153Sdim * It does not pause tracing or analyzing threading APIs. 223345153Sdim * . 224345153Sdim * - Intel(R) Parallel Amplifier and Intel(R) VTune(TM) Amplifier XE: 225345153Sdim * - Does continue to record when new threads are started. 226345153Sdim * . 227345153Sdim * - Other effects: 228345153Sdim * - Possible reduction of runtime overhead. 229345153Sdim * . 230345153Sdim * @{ 231345153Sdim */ 232345153Sdim#ifndef _ITTNOTIFY_H_ 233345153Sdim/** @brief Pause collection */ 234345153Sdimvoid ITTAPI __itt_pause(void); 235345153Sdim/** @brief Resume collection */ 236345153Sdimvoid ITTAPI __itt_resume(void); 237345153Sdim/** @brief Detach collection */ 238345153Sdimvoid ITTAPI __itt_detach(void); 239345153Sdim 240345153Sdim/** @cond exclude_from_documentation */ 241345153Sdim#ifndef INTEL_NO_MACRO_BODY 242345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 243345153SdimITT_STUBV(ITTAPI, void, pause, (void)) 244345153SdimITT_STUBV(ITTAPI, void, resume, (void)) 245345153SdimITT_STUBV(ITTAPI, void, detach, (void)) 246345153Sdim#define __itt_pause ITTNOTIFY_VOID(pause) 247345153Sdim#define __itt_pause_ptr ITTNOTIFY_NAME(pause) 248345153Sdim#define __itt_resume ITTNOTIFY_VOID(resume) 249345153Sdim#define __itt_resume_ptr ITTNOTIFY_NAME(resume) 250345153Sdim#define __itt_detach ITTNOTIFY_VOID(detach) 251345153Sdim#define __itt_detach_ptr ITTNOTIFY_NAME(detach) 252345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 253345153Sdim#define __itt_pause() 254345153Sdim#define __itt_pause_ptr 0 255345153Sdim#define __itt_resume() 256345153Sdim#define __itt_resume_ptr 0 257345153Sdim#define __itt_detach() 258345153Sdim#define __itt_detach_ptr 0 259345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 260345153Sdim#else /* INTEL_NO_MACRO_BODY */ 261345153Sdim#define __itt_pause_ptr 0 262345153Sdim#define __itt_resume_ptr 0 263345153Sdim#define __itt_detach_ptr 0 264345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 265345153Sdim/** @endcond */ 266345153Sdim#endif /* _ITTNOTIFY_H_ */ 267345153Sdim/** @} legacy_control group */ 268345153Sdim 269345153Sdim/** 270345153Sdim * @defgroup legacy_threads Threads 271345153Sdim * @ingroup legacy 272345153Sdim * Threads group 273345153Sdim * @warning Legacy API 274345153Sdim * @{ 275345153Sdim */ 276345153Sdim/** 277345153Sdim * @deprecated Legacy API 278345153Sdim * @brief Set name to be associated with thread in analysis GUI. 279345153Sdim * @return __itt_err upon failure (name or namelen being null,name and namelen mismatched) 280345153Sdim */ 281345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 282345153Sdimint LIBITTAPI __itt_thr_name_setA(const char *name, int namelen); 283345153Sdimint LIBITTAPI __itt_thr_name_setW(const wchar_t *name, int namelen); 284345153Sdim#if defined(UNICODE) || defined(_UNICODE) 285345153Sdim# define __itt_thr_name_set __itt_thr_name_setW 286345153Sdim# define __itt_thr_name_set_ptr __itt_thr_name_setW_ptr 287345153Sdim#else 288345153Sdim# define __itt_thr_name_set __itt_thr_name_setA 289345153Sdim# define __itt_thr_name_set_ptr __itt_thr_name_setA_ptr 290345153Sdim#endif /* UNICODE */ 291345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 292345153Sdimint LIBITTAPI __itt_thr_name_set(const char *name, int namelen); 293345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 294345153Sdim 295345153Sdim/** @cond exclude_from_documentation */ 296345153Sdim#ifndef INTEL_NO_MACRO_BODY 297345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 298345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 299345153SdimITT_STUB(LIBITTAPI, int, thr_name_setA, (const char *name, int namelen)) 300345153SdimITT_STUB(LIBITTAPI, int, thr_name_setW, (const wchar_t *name, int namelen)) 301345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 302345153SdimITT_STUB(LIBITTAPI, int, thr_name_set, (const char *name, int namelen)) 303345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 304345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 305345153Sdim#define __itt_thr_name_setA ITTNOTIFY_DATA(thr_name_setA) 306345153Sdim#define __itt_thr_name_setA_ptr ITTNOTIFY_NAME(thr_name_setA) 307345153Sdim#define __itt_thr_name_setW ITTNOTIFY_DATA(thr_name_setW) 308345153Sdim#define __itt_thr_name_setW_ptr ITTNOTIFY_NAME(thr_name_setW) 309345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 310345153Sdim#define __itt_thr_name_set ITTNOTIFY_DATA(thr_name_set) 311345153Sdim#define __itt_thr_name_set_ptr ITTNOTIFY_NAME(thr_name_set) 312345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 313345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 314345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 315345153Sdim#define __itt_thr_name_setA(name, namelen) 316345153Sdim#define __itt_thr_name_setA_ptr 0 317345153Sdim#define __itt_thr_name_setW(name, namelen) 318345153Sdim#define __itt_thr_name_setW_ptr 0 319345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 320345153Sdim#define __itt_thr_name_set(name, namelen) 321345153Sdim#define __itt_thr_name_set_ptr 0 322345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 323345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 324345153Sdim#else /* INTEL_NO_MACRO_BODY */ 325345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 326345153Sdim#define __itt_thr_name_setA_ptr 0 327345153Sdim#define __itt_thr_name_setW_ptr 0 328345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 329345153Sdim#define __itt_thr_name_set_ptr 0 330345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 331345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 332345153Sdim/** @endcond */ 333345153Sdim 334345153Sdim/** 335345153Sdim * @deprecated Legacy API 336345153Sdim * @brief Mark current thread as ignored from this point on, for the duration of its existence. 337345153Sdim */ 338345153Sdimvoid LIBITTAPI __itt_thr_ignore(void); 339345153Sdim 340345153Sdim/** @cond exclude_from_documentation */ 341345153Sdim#ifndef INTEL_NO_MACRO_BODY 342345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 343345153SdimITT_STUBV(LIBITTAPI, void, thr_ignore, (void)) 344345153Sdim#define __itt_thr_ignore ITTNOTIFY_VOID(thr_ignore) 345345153Sdim#define __itt_thr_ignore_ptr ITTNOTIFY_NAME(thr_ignore) 346345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 347345153Sdim#define __itt_thr_ignore() 348345153Sdim#define __itt_thr_ignore_ptr 0 349345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 350345153Sdim#else /* INTEL_NO_MACRO_BODY */ 351345153Sdim#define __itt_thr_ignore_ptr 0 352345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 353345153Sdim/** @endcond */ 354345153Sdim/** @} legacy_threads group */ 355345153Sdim 356345153Sdim/** 357345153Sdim * @defgroup legacy_sync Synchronization 358345153Sdim * @ingroup legacy 359345153Sdim * Synchronization group 360345153Sdim * @warning Legacy API 361345153Sdim * @{ 362345153Sdim */ 363345153Sdim/** 364345153Sdim * @hideinitializer 365345153Sdim * @brief possible value of attribute argument for sync object type 366345153Sdim */ 367345153Sdim#define __itt_attr_barrier 1 368345153Sdim 369345153Sdim/** 370345153Sdim * @hideinitializer 371345153Sdim * @brief possible value of attribute argument for sync object type 372345153Sdim */ 373345153Sdim#define __itt_attr_mutex 2 374345153Sdim 375345153Sdim/** 376345153Sdim * @deprecated Legacy API 377345153Sdim * @brief Assign a name to a sync object using char or Unicode string 378345153Sdim * @param[in] addr - pointer to the sync object. You should use a real pointer to your object 379345153Sdim * to make sure that the values don't clash with other object addresses 380345153Sdim * @param[in] objtype - null-terminated object type string. If NULL is passed, the object will 381345153Sdim * be assumed to be of generic "User Synchronization" type 382345153Sdim * @param[in] objname - null-terminated object name string. If NULL, no name will be assigned 383345153Sdim * to the object -- you can use the __itt_sync_rename call later to assign 384345153Sdim * the name 385345153Sdim * @param[in] attribute - one of [#__itt_attr_barrier, #__itt_attr_mutex] values which defines the 386345153Sdim * exact semantics of how prepare/acquired/releasing calls work. 387345153Sdim */ 388345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 389345153Sdimvoid ITTAPI __itt_sync_set_nameA(void *addr, const char *objtype, const char *objname, int attribute); 390345153Sdimvoid ITTAPI __itt_sync_set_nameW(void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute); 391345153Sdim#if defined(UNICODE) || defined(_UNICODE) 392345153Sdim# define __itt_sync_set_name __itt_sync_set_nameW 393345153Sdim# define __itt_sync_set_name_ptr __itt_sync_set_nameW_ptr 394345153Sdim#else /* UNICODE */ 395345153Sdim# define __itt_sync_set_name __itt_sync_set_nameA 396345153Sdim# define __itt_sync_set_name_ptr __itt_sync_set_nameA_ptr 397345153Sdim#endif /* UNICODE */ 398345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 399345153Sdimvoid ITTAPI __itt_sync_set_name(void *addr, const char* objtype, const char* objname, int attribute); 400345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 401345153Sdim 402345153Sdim/** @cond exclude_from_documentation */ 403345153Sdim#ifndef INTEL_NO_MACRO_BODY 404345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 405345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 406345153SdimITT_STUBV(ITTAPI, void, sync_set_nameA, (void *addr, const char *objtype, const char *objname, int attribute)) 407345153SdimITT_STUBV(ITTAPI, void, sync_set_nameW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute)) 408345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 409345153SdimITT_STUBV(ITTAPI, void, sync_set_name, (void *addr, const char *objtype, const char *objname, int attribute)) 410345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 411345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 412345153Sdim#define __itt_sync_set_nameA ITTNOTIFY_VOID(sync_set_nameA) 413345153Sdim#define __itt_sync_set_nameA_ptr ITTNOTIFY_NAME(sync_set_nameA) 414345153Sdim#define __itt_sync_set_nameW ITTNOTIFY_VOID(sync_set_nameW) 415345153Sdim#define __itt_sync_set_nameW_ptr ITTNOTIFY_NAME(sync_set_nameW) 416345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 417345153Sdim#define __itt_sync_set_name ITTNOTIFY_VOID(sync_set_name) 418345153Sdim#define __itt_sync_set_name_ptr ITTNOTIFY_NAME(sync_set_name) 419345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 420345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 421345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 422345153Sdim#define __itt_sync_set_nameA(addr, objtype, objname, attribute) 423345153Sdim#define __itt_sync_set_nameA_ptr 0 424345153Sdim#define __itt_sync_set_nameW(addr, objtype, objname, attribute) 425345153Sdim#define __itt_sync_set_nameW_ptr 0 426345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 427345153Sdim#define __itt_sync_set_name(addr, objtype, objname, attribute) 428345153Sdim#define __itt_sync_set_name_ptr 0 429345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 430345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 431345153Sdim#else /* INTEL_NO_MACRO_BODY */ 432345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 433345153Sdim#define __itt_sync_set_nameA_ptr 0 434345153Sdim#define __itt_sync_set_nameW_ptr 0 435345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 436345153Sdim#define __itt_sync_set_name_ptr 0 437345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 438345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 439345153Sdim/** @endcond */ 440345153Sdim 441345153Sdim/** 442345153Sdim * @deprecated Legacy API 443345153Sdim * @brief Assign a name and type to a sync object using char or Unicode string 444345153Sdim * @param[in] addr - pointer to the sync object. You should use a real pointer to your object 445345153Sdim * to make sure that the values don't clash with other object addresses 446345153Sdim * @param[in] objtype - null-terminated object type string. If NULL is passed, the object will 447345153Sdim * be assumed to be of generic "User Synchronization" type 448345153Sdim * @param[in] objname - null-terminated object name string. If NULL, no name will be assigned 449345153Sdim * to the object -- you can use the __itt_sync_rename call later to assign 450345153Sdim * the name 451345153Sdim * @param[in] typelen, namelen - a length of string for appropriate objtype and objname parameter 452345153Sdim * @param[in] attribute - one of [#__itt_attr_barrier, #__itt_attr_mutex] values which defines the 453345153Sdim * exact semantics of how prepare/acquired/releasing calls work. 454345153Sdim * @return __itt_err upon failure (name or namelen being null,name and namelen mismatched) 455345153Sdim */ 456345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 457345153Sdimint LIBITTAPI __itt_notify_sync_nameA(void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute); 458345153Sdimint LIBITTAPI __itt_notify_sync_nameW(void *addr, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute); 459345153Sdim#if defined(UNICODE) || defined(_UNICODE) 460345153Sdim# define __itt_notify_sync_name __itt_notify_sync_nameW 461345153Sdim#else 462345153Sdim# define __itt_notify_sync_name __itt_notify_sync_nameA 463345153Sdim#endif 464345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 465345153Sdimint LIBITTAPI __itt_notify_sync_name(void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute); 466345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 467345153Sdim 468345153Sdim/** @cond exclude_from_documentation */ 469345153Sdim#ifndef INTEL_NO_MACRO_BODY 470345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 471345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 472345153SdimITT_STUB(LIBITTAPI, int, notify_sync_nameA, (void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute)) 473345153SdimITT_STUB(LIBITTAPI, int, notify_sync_nameW, (void *addr, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute)) 474345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 475345153SdimITT_STUB(LIBITTAPI, int, notify_sync_name, (void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute)) 476345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 477345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 478345153Sdim#define __itt_notify_sync_nameA ITTNOTIFY_DATA(notify_sync_nameA) 479345153Sdim#define __itt_notify_sync_nameA_ptr ITTNOTIFY_NAME(notify_sync_nameA) 480345153Sdim#define __itt_notify_sync_nameW ITTNOTIFY_DATA(notify_sync_nameW) 481345153Sdim#define __itt_notify_sync_nameW_ptr ITTNOTIFY_NAME(notify_sync_nameW) 482345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 483345153Sdim#define __itt_notify_sync_name ITTNOTIFY_DATA(notify_sync_name) 484345153Sdim#define __itt_notify_sync_name_ptr ITTNOTIFY_NAME(notify_sync_name) 485345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 486345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 487345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 488345153Sdim#define __itt_notify_sync_nameA(addr, objtype, typelen, objname, namelen, attribute) 489345153Sdim#define __itt_notify_sync_nameA_ptr 0 490345153Sdim#define __itt_notify_sync_nameW(addr, objtype, typelen, objname, namelen, attribute) 491345153Sdim#define __itt_notify_sync_nameW_ptr 0 492345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 493345153Sdim#define __itt_notify_sync_name(addr, objtype, typelen, objname, namelen, attribute) 494345153Sdim#define __itt_notify_sync_name_ptr 0 495345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 496345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 497345153Sdim#else /* INTEL_NO_MACRO_BODY */ 498345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 499345153Sdim#define __itt_notify_sync_nameA_ptr 0 500345153Sdim#define __itt_notify_sync_nameW_ptr 0 501345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 502345153Sdim#define __itt_notify_sync_name_ptr 0 503345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 504345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 505345153Sdim/** @endcond */ 506345153Sdim 507345153Sdim/** 508345153Sdim * @deprecated Legacy API 509345153Sdim * @brief Enter spin loop on user-defined sync object 510345153Sdim */ 511345153Sdimvoid LIBITTAPI __itt_notify_sync_prepare(void* addr); 512345153Sdim 513345153Sdim/** @cond exclude_from_documentation */ 514345153Sdim#ifndef INTEL_NO_MACRO_BODY 515345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 516345153SdimITT_STUBV(LIBITTAPI, void, notify_sync_prepare, (void *addr)) 517345153Sdim#define __itt_notify_sync_prepare ITTNOTIFY_VOID(notify_sync_prepare) 518345153Sdim#define __itt_notify_sync_prepare_ptr ITTNOTIFY_NAME(notify_sync_prepare) 519345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 520345153Sdim#define __itt_notify_sync_prepare(addr) 521345153Sdim#define __itt_notify_sync_prepare_ptr 0 522345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 523345153Sdim#else /* INTEL_NO_MACRO_BODY */ 524345153Sdim#define __itt_notify_sync_prepare_ptr 0 525345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 526345153Sdim/** @endcond */ 527345153Sdim 528345153Sdim/** 529345153Sdim * @deprecated Legacy API 530345153Sdim * @brief Quit spin loop without acquiring spin object 531345153Sdim */ 532345153Sdimvoid LIBITTAPI __itt_notify_sync_cancel(void *addr); 533345153Sdim 534345153Sdim/** @cond exclude_from_documentation */ 535345153Sdim#ifndef INTEL_NO_MACRO_BODY 536345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 537345153SdimITT_STUBV(LIBITTAPI, void, notify_sync_cancel, (void *addr)) 538345153Sdim#define __itt_notify_sync_cancel ITTNOTIFY_VOID(notify_sync_cancel) 539345153Sdim#define __itt_notify_sync_cancel_ptr ITTNOTIFY_NAME(notify_sync_cancel) 540345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 541345153Sdim#define __itt_notify_sync_cancel(addr) 542345153Sdim#define __itt_notify_sync_cancel_ptr 0 543345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 544345153Sdim#else /* INTEL_NO_MACRO_BODY */ 545345153Sdim#define __itt_notify_sync_cancel_ptr 0 546345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 547345153Sdim/** @endcond */ 548345153Sdim 549345153Sdim/** 550345153Sdim * @deprecated Legacy API 551345153Sdim * @brief Successful spin loop completion (sync object acquired) 552345153Sdim */ 553345153Sdimvoid LIBITTAPI __itt_notify_sync_acquired(void *addr); 554345153Sdim 555345153Sdim/** @cond exclude_from_documentation */ 556345153Sdim#ifndef INTEL_NO_MACRO_BODY 557345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 558345153SdimITT_STUBV(LIBITTAPI, void, notify_sync_acquired, (void *addr)) 559345153Sdim#define __itt_notify_sync_acquired ITTNOTIFY_VOID(notify_sync_acquired) 560345153Sdim#define __itt_notify_sync_acquired_ptr ITTNOTIFY_NAME(notify_sync_acquired) 561345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 562345153Sdim#define __itt_notify_sync_acquired(addr) 563345153Sdim#define __itt_notify_sync_acquired_ptr 0 564345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 565345153Sdim#else /* INTEL_NO_MACRO_BODY */ 566345153Sdim#define __itt_notify_sync_acquired_ptr 0 567345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 568345153Sdim/** @endcond */ 569345153Sdim 570345153Sdim/** 571345153Sdim * @deprecated Legacy API 572345153Sdim * @brief Start sync object releasing code. Is called before the lock release call. 573345153Sdim */ 574345153Sdimvoid LIBITTAPI __itt_notify_sync_releasing(void* addr); 575345153Sdim 576345153Sdim/** @cond exclude_from_documentation */ 577345153Sdim#ifndef INTEL_NO_MACRO_BODY 578345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 579345153SdimITT_STUBV(LIBITTAPI, void, notify_sync_releasing, (void *addr)) 580345153Sdim#define __itt_notify_sync_releasing ITTNOTIFY_VOID(notify_sync_releasing) 581345153Sdim#define __itt_notify_sync_releasing_ptr ITTNOTIFY_NAME(notify_sync_releasing) 582345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 583345153Sdim#define __itt_notify_sync_releasing(addr) 584345153Sdim#define __itt_notify_sync_releasing_ptr 0 585345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 586345153Sdim#else /* INTEL_NO_MACRO_BODY */ 587345153Sdim#define __itt_notify_sync_releasing_ptr 0 588345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 589345153Sdim/** @endcond */ 590345153Sdim/** @} legacy_sync group */ 591345153Sdim 592345153Sdim#ifndef _ITTNOTIFY_H_ 593345153Sdim/** 594345153Sdim * @defgroup legacy_events Events 595345153Sdim * @ingroup legacy 596345153Sdim * Events group 597345153Sdim * @{ 598345153Sdim */ 599345153Sdim 600345153Sdim/** @brief user event type */ 601345153Sdimtypedef int __itt_event; 602345153Sdim 603345153Sdim/** 604345153Sdim * @brief Create an event notification 605345153Sdim * @note name or namelen being null/name and namelen not matching, user event feature not enabled 606345153Sdim * @return non-zero event identifier upon success and __itt_err otherwise 607345153Sdim */ 608345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 609345153Sdim__itt_event LIBITTAPI __itt_event_createA(const char *name, int namelen); 610345153Sdim__itt_event LIBITTAPI __itt_event_createW(const wchar_t *name, int namelen); 611345153Sdim#if defined(UNICODE) || defined(_UNICODE) 612345153Sdim# define __itt_event_create __itt_event_createW 613345153Sdim# define __itt_event_create_ptr __itt_event_createW_ptr 614345153Sdim#else 615345153Sdim# define __itt_event_create __itt_event_createA 616345153Sdim# define __itt_event_create_ptr __itt_event_createA_ptr 617345153Sdim#endif /* UNICODE */ 618345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 619345153Sdim__itt_event LIBITTAPI __itt_event_create(const char *name, int namelen); 620345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 621345153Sdim 622345153Sdim/** @cond exclude_from_documentation */ 623345153Sdim#ifndef INTEL_NO_MACRO_BODY 624345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 625345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 626345153SdimITT_STUB(LIBITTAPI, __itt_event, event_createA, (const char *name, int namelen)) 627345153SdimITT_STUB(LIBITTAPI, __itt_event, event_createW, (const wchar_t *name, int namelen)) 628345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 629345153SdimITT_STUB(LIBITTAPI, __itt_event, event_create, (const char *name, int namelen)) 630345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 631345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 632345153Sdim#define __itt_event_createA ITTNOTIFY_DATA(event_createA) 633345153Sdim#define __itt_event_createA_ptr ITTNOTIFY_NAME(event_createA) 634345153Sdim#define __itt_event_createW ITTNOTIFY_DATA(event_createW) 635345153Sdim#define __itt_event_createW_ptr ITTNOTIFY_NAME(event_createW) 636345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 637345153Sdim#define __itt_event_create ITTNOTIFY_DATA(event_create) 638345153Sdim#define __itt_event_create_ptr ITTNOTIFY_NAME(event_create) 639345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 640345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 641345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 642345153Sdim#define __itt_event_createA(name, namelen) (__itt_event)0 643345153Sdim#define __itt_event_createA_ptr 0 644345153Sdim#define __itt_event_createW(name, namelen) (__itt_event)0 645345153Sdim#define __itt_event_createW_ptr 0 646345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 647345153Sdim#define __itt_event_create(name, namelen) (__itt_event)0 648345153Sdim#define __itt_event_create_ptr 0 649345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 650345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 651345153Sdim#else /* INTEL_NO_MACRO_BODY */ 652345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 653345153Sdim#define __itt_event_createA_ptr 0 654345153Sdim#define __itt_event_createW_ptr 0 655345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 656345153Sdim#define __itt_event_create_ptr 0 657345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 658345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 659345153Sdim/** @endcond */ 660345153Sdim 661345153Sdim/** 662345153Sdim * @brief Record an event occurrence. 663345153Sdim * @return __itt_err upon failure (invalid event id/user event feature not enabled) 664345153Sdim */ 665345153Sdimint LIBITTAPI __itt_event_start(__itt_event event); 666345153Sdim 667345153Sdim/** @cond exclude_from_documentation */ 668345153Sdim#ifndef INTEL_NO_MACRO_BODY 669345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 670345153SdimITT_STUB(LIBITTAPI, int, event_start, (__itt_event event)) 671345153Sdim#define __itt_event_start ITTNOTIFY_DATA(event_start) 672345153Sdim#define __itt_event_start_ptr ITTNOTIFY_NAME(event_start) 673345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 674345153Sdim#define __itt_event_start(event) (int)0 675345153Sdim#define __itt_event_start_ptr 0 676345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 677345153Sdim#else /* INTEL_NO_MACRO_BODY */ 678345153Sdim#define __itt_event_start_ptr 0 679345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 680345153Sdim/** @endcond */ 681345153Sdim 682345153Sdim/** 683345153Sdim * @brief Record an event end occurrence. 684345153Sdim * @note It is optional if events do not have durations. 685345153Sdim * @return __itt_err upon failure (invalid event id/user event feature not enabled) 686345153Sdim */ 687345153Sdimint LIBITTAPI __itt_event_end(__itt_event event); 688345153Sdim 689345153Sdim/** @cond exclude_from_documentation */ 690345153Sdim#ifndef INTEL_NO_MACRO_BODY 691345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 692345153SdimITT_STUB(LIBITTAPI, int, event_end, (__itt_event event)) 693345153Sdim#define __itt_event_end ITTNOTIFY_DATA(event_end) 694345153Sdim#define __itt_event_end_ptr ITTNOTIFY_NAME(event_end) 695345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 696345153Sdim#define __itt_event_end(event) (int)0 697345153Sdim#define __itt_event_end_ptr 0 698345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 699345153Sdim#else /* INTEL_NO_MACRO_BODY */ 700345153Sdim#define __itt_event_end_ptr 0 701345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 702345153Sdim/** @endcond */ 703345153Sdim/** @} legacy_events group */ 704345153Sdim#endif /* _ITTNOTIFY_H_ */ 705345153Sdim 706345153Sdim/** 707345153Sdim * @defgroup legacy_memory Memory Accesses 708345153Sdim * @ingroup legacy 709345153Sdim */ 710345153Sdim 711345153Sdim/** 712345153Sdim * @deprecated Legacy API 713345153Sdim * @brief Inform the tool of memory accesses on reading 714345153Sdim */ 715345153Sdimvoid LIBITTAPI __itt_memory_read(void *addr, size_t size); 716345153Sdim 717345153Sdim/** @cond exclude_from_documentation */ 718345153Sdim#ifndef INTEL_NO_MACRO_BODY 719345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 720345153SdimITT_STUBV(LIBITTAPI, void, memory_read, (void *addr, size_t size)) 721345153Sdim#define __itt_memory_read ITTNOTIFY_VOID(memory_read) 722345153Sdim#define __itt_memory_read_ptr ITTNOTIFY_NAME(memory_read) 723345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 724345153Sdim#define __itt_memory_read(addr, size) 725345153Sdim#define __itt_memory_read_ptr 0 726345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 727345153Sdim#else /* INTEL_NO_MACRO_BODY */ 728345153Sdim#define __itt_memory_read_ptr 0 729345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 730345153Sdim/** @endcond */ 731345153Sdim 732345153Sdim/** 733345153Sdim * @deprecated Legacy API 734345153Sdim * @brief Inform the tool of memory accesses on writing 735345153Sdim */ 736345153Sdimvoid LIBITTAPI __itt_memory_write(void *addr, size_t size); 737345153Sdim 738345153Sdim/** @cond exclude_from_documentation */ 739345153Sdim#ifndef INTEL_NO_MACRO_BODY 740345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 741345153SdimITT_STUBV(LIBITTAPI, void, memory_write, (void *addr, size_t size)) 742345153Sdim#define __itt_memory_write ITTNOTIFY_VOID(memory_write) 743345153Sdim#define __itt_memory_write_ptr ITTNOTIFY_NAME(memory_write) 744345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 745345153Sdim#define __itt_memory_write(addr, size) 746345153Sdim#define __itt_memory_write_ptr 0 747345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 748345153Sdim#else /* INTEL_NO_MACRO_BODY */ 749345153Sdim#define __itt_memory_write_ptr 0 750345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 751345153Sdim/** @endcond */ 752345153Sdim 753345153Sdim/** 754345153Sdim * @deprecated Legacy API 755345153Sdim * @brief Inform the tool of memory accesses on updating 756345153Sdim */ 757345153Sdimvoid LIBITTAPI __itt_memory_update(void *address, size_t size); 758345153Sdim 759345153Sdim/** @cond exclude_from_documentation */ 760345153Sdim#ifndef INTEL_NO_MACRO_BODY 761345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 762345153SdimITT_STUBV(LIBITTAPI, void, memory_update, (void *addr, size_t size)) 763345153Sdim#define __itt_memory_update ITTNOTIFY_VOID(memory_update) 764345153Sdim#define __itt_memory_update_ptr ITTNOTIFY_NAME(memory_update) 765345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 766345153Sdim#define __itt_memory_update(addr, size) 767345153Sdim#define __itt_memory_update_ptr 0 768345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 769345153Sdim#else /* INTEL_NO_MACRO_BODY */ 770345153Sdim#define __itt_memory_update_ptr 0 771345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 772345153Sdim/** @endcond */ 773345153Sdim/** @} legacy_memory group */ 774345153Sdim 775345153Sdim/** 776345153Sdim * @defgroup legacy_state Thread and Object States 777345153Sdim * @ingroup legacy 778345153Sdim */ 779345153Sdim 780345153Sdim/** @brief state type */ 781345153Sdimtypedef int __itt_state_t; 782345153Sdim 783345153Sdim/** @cond exclude_from_documentation */ 784345153Sdimtypedef enum __itt_obj_state { 785345153Sdim __itt_obj_state_err = 0, 786345153Sdim __itt_obj_state_clr = 1, 787345153Sdim __itt_obj_state_set = 2, 788345153Sdim __itt_obj_state_use = 3 789345153Sdim} __itt_obj_state_t; 790345153Sdim 791345153Sdimtypedef enum __itt_thr_state { 792345153Sdim __itt_thr_state_err = 0, 793345153Sdim __itt_thr_state_clr = 1, 794345153Sdim __itt_thr_state_set = 2 795345153Sdim} __itt_thr_state_t; 796345153Sdim 797345153Sdimtypedef enum __itt_obj_prop { 798345153Sdim __itt_obj_prop_watch = 1, 799345153Sdim __itt_obj_prop_ignore = 2, 800345153Sdim __itt_obj_prop_sharable = 3 801345153Sdim} __itt_obj_prop_t; 802345153Sdim 803345153Sdimtypedef enum __itt_thr_prop { 804345153Sdim __itt_thr_prop_quiet = 1 805345153Sdim} __itt_thr_prop_t; 806345153Sdim/** @endcond */ 807345153Sdim 808345153Sdim/** 809345153Sdim * @deprecated Legacy API 810345153Sdim * @brief managing thread and object states 811345153Sdim */ 812345153Sdim__itt_state_t LIBITTAPI __itt_state_get(void); 813345153Sdim 814345153Sdim/** @cond exclude_from_documentation */ 815345153Sdim#ifndef INTEL_NO_MACRO_BODY 816345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 817345153SdimITT_STUB(ITTAPI, __itt_state_t, state_get, (void)) 818345153Sdim#define __itt_state_get ITTNOTIFY_DATA(state_get) 819345153Sdim#define __itt_state_get_ptr ITTNOTIFY_NAME(state_get) 820345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 821345153Sdim#define __itt_state_get(void) (__itt_state_t)0 822345153Sdim#define __itt_state_get_ptr 0 823345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 824345153Sdim#else /* INTEL_NO_MACRO_BODY */ 825345153Sdim#define __itt_state_get_ptr 0 826345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 827345153Sdim/** @endcond */ 828345153Sdim 829345153Sdim/** 830345153Sdim * @deprecated Legacy API 831345153Sdim * @brief managing thread and object states 832345153Sdim */ 833345153Sdim__itt_state_t LIBITTAPI __itt_state_set(__itt_state_t s); 834345153Sdim 835345153Sdim/** @cond exclude_from_documentation */ 836345153Sdim#ifndef INTEL_NO_MACRO_BODY 837345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 838345153SdimITT_STUB(ITTAPI, __itt_state_t, state_set, (__itt_state_t s)) 839345153Sdim#define __itt_state_set ITTNOTIFY_DATA(state_set) 840345153Sdim#define __itt_state_set_ptr ITTNOTIFY_NAME(state_set) 841345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 842345153Sdim#define __itt_state_set(s) (__itt_state_t)0 843345153Sdim#define __itt_state_set_ptr 0 844345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 845345153Sdim#else /* INTEL_NO_MACRO_BODY */ 846345153Sdim#define __itt_state_set_ptr 0 847345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 848345153Sdim/** @endcond */ 849345153Sdim 850345153Sdim/** 851345153Sdim * @deprecated Legacy API 852345153Sdim * @brief managing thread and object modes 853345153Sdim */ 854345153Sdim__itt_thr_state_t LIBITTAPI __itt_thr_mode_set(__itt_thr_prop_t p, __itt_thr_state_t s); 855345153Sdim 856345153Sdim/** @cond exclude_from_documentation */ 857345153Sdim#ifndef INTEL_NO_MACRO_BODY 858345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 859345153SdimITT_STUB(ITTAPI, __itt_thr_state_t, thr_mode_set, (__itt_thr_prop_t p, __itt_thr_state_t s)) 860345153Sdim#define __itt_thr_mode_set ITTNOTIFY_DATA(thr_mode_set) 861345153Sdim#define __itt_thr_mode_set_ptr ITTNOTIFY_NAME(thr_mode_set) 862345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 863345153Sdim#define __itt_thr_mode_set(p, s) (__itt_thr_state_t)0 864345153Sdim#define __itt_thr_mode_set_ptr 0 865345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 866345153Sdim#else /* INTEL_NO_MACRO_BODY */ 867345153Sdim#define __itt_thr_mode_set_ptr 0 868345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 869345153Sdim/** @endcond */ 870345153Sdim 871345153Sdim/** 872345153Sdim * @deprecated Legacy API 873345153Sdim * @brief managing thread and object modes 874345153Sdim */ 875345153Sdim__itt_obj_state_t LIBITTAPI __itt_obj_mode_set(__itt_obj_prop_t p, __itt_obj_state_t s); 876345153Sdim 877345153Sdim/** @cond exclude_from_documentation */ 878345153Sdim#ifndef INTEL_NO_MACRO_BODY 879345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 880345153SdimITT_STUB(ITTAPI, __itt_obj_state_t, obj_mode_set, (__itt_obj_prop_t p, __itt_obj_state_t s)) 881345153Sdim#define __itt_obj_mode_set ITTNOTIFY_DATA(obj_mode_set) 882345153Sdim#define __itt_obj_mode_set_ptr ITTNOTIFY_NAME(obj_mode_set) 883345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 884345153Sdim#define __itt_obj_mode_set(p, s) (__itt_obj_state_t)0 885345153Sdim#define __itt_obj_mode_set_ptr 0 886345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 887345153Sdim#else /* INTEL_NO_MACRO_BODY */ 888345153Sdim#define __itt_obj_mode_set_ptr 0 889345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 890345153Sdim/** @endcond */ 891345153Sdim/** @} legacy_state group */ 892345153Sdim 893345153Sdim/** 894345153Sdim * @defgroup frames Frames 895345153Sdim * @ingroup legacy 896345153Sdim * Frames group 897345153Sdim * @{ 898345153Sdim */ 899345153Sdim/** 900345153Sdim * @brief opaque structure for frame identification 901345153Sdim */ 902345153Sdimtypedef struct __itt_frame_t *__itt_frame; 903345153Sdim 904345153Sdim/** 905345153Sdim * @brief Create a global frame with given domain 906345153Sdim */ 907345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 908345153Sdim__itt_frame ITTAPI __itt_frame_createA(const char *domain); 909345153Sdim__itt_frame ITTAPI __itt_frame_createW(const wchar_t *domain); 910345153Sdim#if defined(UNICODE) || defined(_UNICODE) 911345153Sdim# define __itt_frame_create __itt_frame_createW 912345153Sdim# define __itt_frame_create_ptr __itt_frame_createW_ptr 913345153Sdim#else /* UNICODE */ 914345153Sdim# define __itt_frame_create __itt_frame_createA 915345153Sdim# define __itt_frame_create_ptr __itt_frame_createA_ptr 916345153Sdim#endif /* UNICODE */ 917345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 918345153Sdim__itt_frame ITTAPI __itt_frame_create(const char *domain); 919345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 920345153Sdim 921345153Sdim/** @cond exclude_from_documentation */ 922345153Sdim#ifndef INTEL_NO_MACRO_BODY 923345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 924345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 925345153SdimITT_STUB(ITTAPI, __itt_frame, frame_createA, (const char *domain)) 926345153SdimITT_STUB(ITTAPI, __itt_frame, frame_createW, (const wchar_t *domain)) 927345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 928345153SdimITT_STUB(ITTAPI, __itt_frame, frame_create, (const char *domain)) 929345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 930345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 931345153Sdim#define __itt_frame_createA ITTNOTIFY_DATA(frame_createA) 932345153Sdim#define __itt_frame_createA_ptr ITTNOTIFY_NAME(frame_createA) 933345153Sdim#define __itt_frame_createW ITTNOTIFY_DATA(frame_createW) 934345153Sdim#define __itt_frame_createW_ptr ITTNOTIFY_NAME(frame_createW) 935345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 936345153Sdim#define __itt_frame_create ITTNOTIFY_DATA(frame_create) 937345153Sdim#define __itt_frame_create_ptr ITTNOTIFY_NAME(frame_create) 938345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 939345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 940345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 941345153Sdim#define __itt_frame_createA(domain) 942345153Sdim#define __itt_frame_createA_ptr 0 943345153Sdim#define __itt_frame_createW(domain) 944345153Sdim#define __itt_frame_createW_ptr 0 945345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 946345153Sdim#define __itt_frame_create(domain) 947345153Sdim#define __itt_frame_create_ptr 0 948345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 949345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 950345153Sdim#else /* INTEL_NO_MACRO_BODY */ 951345153Sdim#if ITT_PLATFORM==ITT_PLATFORM_WIN 952345153Sdim#define __itt_frame_createA_ptr 0 953345153Sdim#define __itt_frame_createW_ptr 0 954345153Sdim#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 955345153Sdim#define __itt_frame_create_ptr 0 956345153Sdim#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ 957345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 958345153Sdim/** @endcond */ 959345153Sdim 960360784Sdim/** @brief Record a frame begin occurrence. */ 961345153Sdimvoid ITTAPI __itt_frame_begin(__itt_frame frame); 962360784Sdim/** @brief Record a frame end occurrence. */ 963345153Sdimvoid ITTAPI __itt_frame_end (__itt_frame frame); 964345153Sdim 965345153Sdim/** @cond exclude_from_documentation */ 966345153Sdim#ifndef INTEL_NO_MACRO_BODY 967345153Sdim#ifndef INTEL_NO_ITTNOTIFY_API 968345153SdimITT_STUBV(ITTAPI, void, frame_begin, (__itt_frame frame)) 969345153SdimITT_STUBV(ITTAPI, void, frame_end, (__itt_frame frame)) 970345153Sdim#define __itt_frame_begin ITTNOTIFY_VOID(frame_begin) 971345153Sdim#define __itt_frame_begin_ptr ITTNOTIFY_NAME(frame_begin) 972345153Sdim#define __itt_frame_end ITTNOTIFY_VOID(frame_end) 973345153Sdim#define __itt_frame_end_ptr ITTNOTIFY_NAME(frame_end) 974345153Sdim#else /* INTEL_NO_ITTNOTIFY_API */ 975345153Sdim#define __itt_frame_begin(frame) 976345153Sdim#define __itt_frame_begin_ptr 0 977345153Sdim#define __itt_frame_end(frame) 978345153Sdim#define __itt_frame_end_ptr 0 979345153Sdim#endif /* INTEL_NO_ITTNOTIFY_API */ 980345153Sdim#else /* INTEL_NO_MACRO_BODY */ 981345153Sdim#define __itt_frame_begin_ptr 0 982345153Sdim#define __itt_frame_end_ptr 0 983345153Sdim#endif /* INTEL_NO_MACRO_BODY */ 984345153Sdim/** @endcond */ 985345153Sdim/** @} frames group */ 986345153Sdim 987345153Sdim#ifdef __cplusplus 988345153Sdim} 989345153Sdim#endif /* __cplusplus */ 990345153Sdim 991345153Sdim#endif /* _LEGACY_ITTNOTIFY_H_ */ 992