ittnotify.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. /*
  3. Copyright (C) 2005-2019 Intel Corporation
  4. SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
  5. */
  6. #ifndef _LEGACY_ITTNOTIFY_H_
  7. #define _LEGACY_ITTNOTIFY_H_
  8. /**
  9. * @file
  10. * @brief Legacy User API functions and types
  11. */
  12. /** @cond exclude_from_documentation */
  13. #ifndef ITT_OS_WIN
  14. # define ITT_OS_WIN 1
  15. #endif /* ITT_OS_WIN */
  16. #ifndef ITT_OS_LINUX
  17. # define ITT_OS_LINUX 2
  18. #endif /* ITT_OS_LINUX */
  19. #ifndef ITT_OS_MAC
  20. # define ITT_OS_MAC 3
  21. #endif /* ITT_OS_MAC */
  22. #ifndef ITT_OS_FREEBSD
  23. # define ITT_OS_FREEBSD 4
  24. #endif /* ITT_OS_FREEBSD */
  25. #ifndef ITT_OS_OPENBSD
  26. # define ITT_OS_OPENBSD 5
  27. #endif /* ITT_OS_OPENBSD */
  28. #ifndef ITT_OS
  29. # if defined WIN32 || defined _WIN32
  30. # define ITT_OS ITT_OS_WIN
  31. # elif defined( __APPLE__ ) && defined( __MACH__ )
  32. # define ITT_OS ITT_OS_MAC
  33. # elif defined( __FreeBSD__ )
  34. # define ITT_OS ITT_OS_FREEBSD
  35. # elif defined( __OpenBSD__ )
  36. # define ITT_OS ITT_OS_OPENBSD
  37. # else
  38. # define ITT_OS ITT_OS_LINUX
  39. # endif
  40. #endif /* ITT_OS */
  41. #ifndef ITT_PLATFORM_WIN
  42. # define ITT_PLATFORM_WIN 1
  43. #endif /* ITT_PLATFORM_WIN */
  44. #ifndef ITT_PLATFORM_POSIX
  45. # define ITT_PLATFORM_POSIX 2
  46. #endif /* ITT_PLATFORM_POSIX */
  47. #ifndef ITT_PLATFORM_MAC
  48. # define ITT_PLATFORM_MAC 3
  49. #endif /* ITT_PLATFORM_MAC */
  50. #ifndef ITT_PLATFORM_FREEBSD
  51. # define ITT_PLATFORM_FREEBSD 4
  52. #endif /* ITT_PLATFORM_FREEBSD */
  53. #ifndef ITT_PLATFORM_OPENBSD
  54. # define ITT_PLATFORM_OPENBSD 5
  55. #endif /* ITT_PLATFORM_OPENBSD */
  56. #ifndef ITT_PLATFORM
  57. # if ITT_OS==ITT_OS_WIN
  58. # define ITT_PLATFORM ITT_PLATFORM_WIN
  59. # elif ITT_OS==ITT_OS_MAC
  60. # define ITT_PLATFORM ITT_PLATFORM_MAC
  61. # elif ITT_OS==ITT_OS_FREEBSD
  62. # define ITT_PLATFORM ITT_PLATFORM_FREEBSD
  63. # elif ITT_OS==ITT_OS_OPENBSD
  64. # define ITT_PLATFORM ITT_PLATFORM_OPENBSD
  65. # else
  66. # define ITT_PLATFORM ITT_PLATFORM_POSIX
  67. # endif
  68. #endif /* ITT_PLATFORM */
  69. #if defined(_UNICODE) && !defined(UNICODE)
  70. #define UNICODE
  71. #endif
  72. #include <stddef.h>
  73. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  74. #include <tchar.h>
  75. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  76. #include <stdint.h>
  77. #if defined(UNICODE) || defined(_UNICODE)
  78. #include <wchar.h>
  79. #endif /* UNICODE || _UNICODE */
  80. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  81. #ifndef ITTAPI_CDECL
  82. # if ITT_PLATFORM==ITT_PLATFORM_WIN
  83. # define ITTAPI_CDECL __cdecl
  84. # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  85. # if defined _M_IX86 || defined __i386__
  86. # define ITTAPI_CDECL __attribute__ ((cdecl))
  87. # else /* _M_IX86 || __i386__ */
  88. # define ITTAPI_CDECL /* actual only on x86 platform */
  89. # endif /* _M_IX86 || __i386__ */
  90. # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  91. #endif /* ITTAPI_CDECL */
  92. #ifndef STDCALL
  93. # if ITT_PLATFORM==ITT_PLATFORM_WIN
  94. # define STDCALL __stdcall
  95. # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  96. # if defined _M_IX86 || defined __i386__
  97. # define STDCALL __attribute__ ((stdcall))
  98. # else /* _M_IX86 || __i386__ */
  99. # define STDCALL /* supported only on x86 platform */
  100. # endif /* _M_IX86 || __i386__ */
  101. # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  102. #endif /* STDCALL */
  103. #define ITTAPI ITTAPI_CDECL
  104. #define LIBITTAPI ITTAPI_CDECL
  105. /* TODO: Temporary for compatibility! */
  106. #define ITTAPI_CALL ITTAPI_CDECL
  107. #define LIBITTAPI_CALL ITTAPI_CDECL
  108. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  109. /* use __forceinline (VC++ specific) */
  110. #if defined(__MINGW32__) && !defined(__cplusplus)
  111. #define ITT_INLINE static __inline__ __attribute__((__always_inline__,__gnu_inline__))
  112. #else
  113. #define ITT_INLINE static __forceinline
  114. #endif /* __MINGW32__ */
  115. #define ITT_INLINE_ATTRIBUTE /* nothing */
  116. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  117. /*
  118. * Generally, functions are not inlined unless optimization is specified.
  119. * For functions declared inline, this attribute inlines the function even
  120. * if no optimization level was specified.
  121. */
  122. #ifdef __STRICT_ANSI__
  123. #define ITT_INLINE static
  124. #define ITT_INLINE_ATTRIBUTE __attribute__((unused))
  125. #else /* __STRICT_ANSI__ */
  126. #define ITT_INLINE static inline
  127. #define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
  128. #endif /* __STRICT_ANSI__ */
  129. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  130. /** @endcond */
  131. /** @cond exclude_from_documentation */
  132. /* Helper macro for joining tokens */
  133. #define ITT_JOIN_AUX(p,n) p##n
  134. #define ITT_JOIN(p,n) ITT_JOIN_AUX(p,n)
  135. #ifdef ITT_MAJOR
  136. #undef ITT_MAJOR
  137. #endif
  138. #ifdef ITT_MINOR
  139. #undef ITT_MINOR
  140. #endif
  141. #define ITT_MAJOR 3
  142. #define ITT_MINOR 0
  143. /* Standard versioning of a token with major and minor version numbers */
  144. #define ITT_VERSIONIZE(x) \
  145. ITT_JOIN(x, \
  146. ITT_JOIN(_, \
  147. ITT_JOIN(ITT_MAJOR, \
  148. ITT_JOIN(_, ITT_MINOR))))
  149. #ifndef INTEL_ITTNOTIFY_PREFIX
  150. # define INTEL_ITTNOTIFY_PREFIX __itt_
  151. #endif /* INTEL_ITTNOTIFY_PREFIX */
  152. #ifndef INTEL_ITTNOTIFY_POSTFIX
  153. # define INTEL_ITTNOTIFY_POSTFIX _ptr_
  154. #endif /* INTEL_ITTNOTIFY_POSTFIX */
  155. #define ITTNOTIFY_NAME_AUX(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n)
  156. #define ITTNOTIFY_NAME(n) ITT_VERSIONIZE(ITTNOTIFY_NAME_AUX(ITT_JOIN(n,INTEL_ITTNOTIFY_POSTFIX)))
  157. #define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)
  158. #define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)
  159. #define ITTNOTIFY_VOID_D0(n,d) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d)
  160. #define ITTNOTIFY_VOID_D1(n,d,x) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x)
  161. #define ITTNOTIFY_VOID_D2(n,d,x,y) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y)
  162. #define ITTNOTIFY_VOID_D3(n,d,x,y,z) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z)
  163. #define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a)
  164. #define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b)
  165. #define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c)
  166. #define ITTNOTIFY_DATA_D0(n,d) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d)
  167. #define ITTNOTIFY_DATA_D1(n,d,x) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x)
  168. #define ITTNOTIFY_DATA_D2(n,d,x,y) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y)
  169. #define ITTNOTIFY_DATA_D3(n,d,x,y,z) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z)
  170. #define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a)
  171. #define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b)
  172. #define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c)
  173. #ifdef ITT_STUB
  174. #undef ITT_STUB
  175. #endif
  176. #ifdef ITT_STUBV
  177. #undef ITT_STUBV
  178. #endif
  179. #define ITT_STUBV(api,type,name,args) \
  180. typedef type (api* ITT_JOIN(ITTNOTIFY_NAME(name),_t)) args; \
  181. extern ITT_JOIN(ITTNOTIFY_NAME(name),_t) ITTNOTIFY_NAME(name);
  182. #define ITT_STUB ITT_STUBV
  183. /** @endcond */
  184. #ifdef __cplusplus
  185. extern "C" {
  186. #endif /* __cplusplus */
  187. /**
  188. * @defgroup legacy Legacy API
  189. * @{
  190. * @}
  191. */
  192. /**
  193. * @defgroup legacy_control Collection Control
  194. * @ingroup legacy
  195. * General behavior: application continues to run, but no profiling information is being collected
  196. *
  197. * Pausing occurs not only for the current thread but for all process as well as spawned processes
  198. * - Intel(R) Parallel Inspector and Intel(R) Inspector XE:
  199. * - Does not analyze or report errors that involve memory access.
  200. * - Other errors are reported as usual. Pausing data collection in
  201. * Intel(R) Parallel Inspector and Intel(R) Inspector XE
  202. * only pauses tracing and analyzing memory access.
  203. * It does not pause tracing or analyzing threading APIs.
  204. * .
  205. * - Intel(R) VTune(TM) Profiler:
  206. * - Does continue to record when new threads are started.
  207. * .
  208. * - Other effects:
  209. * - Possible reduction of runtime overhead.
  210. * .
  211. * @{
  212. */
  213. #ifndef _ITTNOTIFY_H_
  214. /** @brief Pause collection */
  215. void ITTAPI __itt_pause(void);
  216. /** @brief Resume collection */
  217. void ITTAPI __itt_resume(void);
  218. /** @brief Detach collection */
  219. void ITTAPI __itt_detach(void);
  220. /** @cond exclude_from_documentation */
  221. #ifndef INTEL_NO_MACRO_BODY
  222. #ifndef INTEL_NO_ITTNOTIFY_API
  223. ITT_STUBV(ITTAPI, void, pause, (void))
  224. ITT_STUBV(ITTAPI, void, resume, (void))
  225. ITT_STUBV(ITTAPI, void, detach, (void))
  226. #define __itt_pause ITTNOTIFY_VOID(pause)
  227. #define __itt_pause_ptr ITTNOTIFY_NAME(pause)
  228. #define __itt_resume ITTNOTIFY_VOID(resume)
  229. #define __itt_resume_ptr ITTNOTIFY_NAME(resume)
  230. #define __itt_detach ITTNOTIFY_VOID(detach)
  231. #define __itt_detach_ptr ITTNOTIFY_NAME(detach)
  232. #else /* INTEL_NO_ITTNOTIFY_API */
  233. #define __itt_pause()
  234. #define __itt_pause_ptr 0
  235. #define __itt_resume()
  236. #define __itt_resume_ptr 0
  237. #define __itt_detach()
  238. #define __itt_detach_ptr 0
  239. #endif /* INTEL_NO_ITTNOTIFY_API */
  240. #else /* INTEL_NO_MACRO_BODY */
  241. #define __itt_pause_ptr 0
  242. #define __itt_resume_ptr 0
  243. #define __itt_detach_ptr 0
  244. #endif /* INTEL_NO_MACRO_BODY */
  245. /** @endcond */
  246. #endif /* _ITTNOTIFY_H_ */
  247. /** @} legacy_control group */
  248. /**
  249. * @defgroup legacy_threads Threads
  250. * @ingroup legacy
  251. * Threads group
  252. * @warning Legacy API
  253. * @{
  254. */
  255. /**
  256. * @deprecated Legacy API
  257. * @brief Set name to be associated with thread in analysis GUI.
  258. * @return __itt_err upon failure (name or namelen being null,name and namelen mismatched)
  259. */
  260. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  261. int LIBITTAPI __itt_thr_name_setA(const char *name, int namelen);
  262. int LIBITTAPI __itt_thr_name_setW(const wchar_t *name, int namelen);
  263. #if defined(UNICODE) || defined(_UNICODE)
  264. # define __itt_thr_name_set __itt_thr_name_setW
  265. # define __itt_thr_name_set_ptr __itt_thr_name_setW_ptr
  266. #else
  267. # define __itt_thr_name_set __itt_thr_name_setA
  268. # define __itt_thr_name_set_ptr __itt_thr_name_setA_ptr
  269. #endif /* UNICODE */
  270. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  271. int LIBITTAPI __itt_thr_name_set(const char *name, int namelen);
  272. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  273. /** @cond exclude_from_documentation */
  274. #ifndef INTEL_NO_MACRO_BODY
  275. #ifndef INTEL_NO_ITTNOTIFY_API
  276. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  277. ITT_STUB(LIBITTAPI, int, thr_name_setA, (const char *name, int namelen))
  278. ITT_STUB(LIBITTAPI, int, thr_name_setW, (const wchar_t *name, int namelen))
  279. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  280. ITT_STUB(LIBITTAPI, int, thr_name_set, (const char *name, int namelen))
  281. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  282. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  283. #define __itt_thr_name_setA ITTNOTIFY_DATA(thr_name_setA)
  284. #define __itt_thr_name_setA_ptr ITTNOTIFY_NAME(thr_name_setA)
  285. #define __itt_thr_name_setW ITTNOTIFY_DATA(thr_name_setW)
  286. #define __itt_thr_name_setW_ptr ITTNOTIFY_NAME(thr_name_setW)
  287. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  288. #define __itt_thr_name_set ITTNOTIFY_DATA(thr_name_set)
  289. #define __itt_thr_name_set_ptr ITTNOTIFY_NAME(thr_name_set)
  290. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  291. #else /* INTEL_NO_ITTNOTIFY_API */
  292. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  293. #define __itt_thr_name_setA(name, namelen)
  294. #define __itt_thr_name_setA_ptr 0
  295. #define __itt_thr_name_setW(name, namelen)
  296. #define __itt_thr_name_setW_ptr 0
  297. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  298. #define __itt_thr_name_set(name, namelen)
  299. #define __itt_thr_name_set_ptr 0
  300. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  301. #endif /* INTEL_NO_ITTNOTIFY_API */
  302. #else /* INTEL_NO_MACRO_BODY */
  303. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  304. #define __itt_thr_name_setA_ptr 0
  305. #define __itt_thr_name_setW_ptr 0
  306. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  307. #define __itt_thr_name_set_ptr 0
  308. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  309. #endif /* INTEL_NO_MACRO_BODY */
  310. /** @endcond */
  311. /**
  312. * @deprecated Legacy API
  313. * @brief Mark current thread as ignored from this point on, for the duration of its existence.
  314. */
  315. void LIBITTAPI __itt_thr_ignore(void);
  316. /** @cond exclude_from_documentation */
  317. #ifndef INTEL_NO_MACRO_BODY
  318. #ifndef INTEL_NO_ITTNOTIFY_API
  319. ITT_STUBV(LIBITTAPI, void, thr_ignore, (void))
  320. #define __itt_thr_ignore ITTNOTIFY_VOID(thr_ignore)
  321. #define __itt_thr_ignore_ptr ITTNOTIFY_NAME(thr_ignore)
  322. #else /* INTEL_NO_ITTNOTIFY_API */
  323. #define __itt_thr_ignore()
  324. #define __itt_thr_ignore_ptr 0
  325. #endif /* INTEL_NO_ITTNOTIFY_API */
  326. #else /* INTEL_NO_MACRO_BODY */
  327. #define __itt_thr_ignore_ptr 0
  328. #endif /* INTEL_NO_MACRO_BODY */
  329. /** @endcond */
  330. /** @} legacy_threads group */
  331. /**
  332. * @defgroup legacy_sync Synchronization
  333. * @ingroup legacy
  334. * Synchronization group
  335. * @warning Legacy API
  336. * @{
  337. */
  338. /**
  339. * @hideinitializer
  340. * @brief possible value of attribute argument for sync object type
  341. */
  342. #define __itt_attr_barrier 1
  343. /**
  344. * @hideinitializer
  345. * @brief possible value of attribute argument for sync object type
  346. */
  347. #define __itt_attr_mutex 2
  348. /**
  349. * @deprecated Legacy API
  350. * @brief Assign a name to a sync object using char or Unicode string
  351. * @param[in] addr - pointer to the sync object. You should use a real pointer to your object
  352. * to make sure that the values don't clash with other object addresses
  353. * @param[in] objtype - null-terminated object type string. If NULL is passed, the object will
  354. * be assumed to be of generic "User Synchronization" type
  355. * @param[in] objname - null-terminated object name string. If NULL, no name will be assigned
  356. * to the object -- you can use the __itt_sync_rename call later to assign
  357. * the name
  358. * @param[in] attribute - one of [#__itt_attr_barrier, #__itt_attr_mutex] values which defines the
  359. * exact semantics of how prepare/acquired/releasing calls work.
  360. */
  361. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  362. void ITTAPI __itt_sync_set_nameA(void *addr, const char *objtype, const char *objname, int attribute);
  363. void ITTAPI __itt_sync_set_nameW(void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute);
  364. #if defined(UNICODE) || defined(_UNICODE)
  365. # define __itt_sync_set_name __itt_sync_set_nameW
  366. # define __itt_sync_set_name_ptr __itt_sync_set_nameW_ptr
  367. #else /* UNICODE */
  368. # define __itt_sync_set_name __itt_sync_set_nameA
  369. # define __itt_sync_set_name_ptr __itt_sync_set_nameA_ptr
  370. #endif /* UNICODE */
  371. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  372. void ITTAPI __itt_sync_set_name(void *addr, const char* objtype, const char* objname, int attribute);
  373. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  374. /** @cond exclude_from_documentation */
  375. #ifndef INTEL_NO_MACRO_BODY
  376. #ifndef INTEL_NO_ITTNOTIFY_API
  377. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  378. ITT_STUBV(ITTAPI, void, sync_set_nameA, (void *addr, const char *objtype, const char *objname, int attribute))
  379. ITT_STUBV(ITTAPI, void, sync_set_nameW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute))
  380. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  381. ITT_STUBV(ITTAPI, void, sync_set_name, (void *addr, const char *objtype, const char *objname, int attribute))
  382. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  383. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  384. #define __itt_sync_set_nameA ITTNOTIFY_VOID(sync_set_nameA)
  385. #define __itt_sync_set_nameA_ptr ITTNOTIFY_NAME(sync_set_nameA)
  386. #define __itt_sync_set_nameW ITTNOTIFY_VOID(sync_set_nameW)
  387. #define __itt_sync_set_nameW_ptr ITTNOTIFY_NAME(sync_set_nameW)
  388. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  389. #define __itt_sync_set_name ITTNOTIFY_VOID(sync_set_name)
  390. #define __itt_sync_set_name_ptr ITTNOTIFY_NAME(sync_set_name)
  391. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  392. #else /* INTEL_NO_ITTNOTIFY_API */
  393. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  394. #define __itt_sync_set_nameA(addr, objtype, objname, attribute)
  395. #define __itt_sync_set_nameA_ptr 0
  396. #define __itt_sync_set_nameW(addr, objtype, objname, attribute)
  397. #define __itt_sync_set_nameW_ptr 0
  398. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  399. #define __itt_sync_set_name(addr, objtype, objname, attribute)
  400. #define __itt_sync_set_name_ptr 0
  401. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  402. #endif /* INTEL_NO_ITTNOTIFY_API */
  403. #else /* INTEL_NO_MACRO_BODY */
  404. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  405. #define __itt_sync_set_nameA_ptr 0
  406. #define __itt_sync_set_nameW_ptr 0
  407. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  408. #define __itt_sync_set_name_ptr 0
  409. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  410. #endif /* INTEL_NO_MACRO_BODY */
  411. /** @endcond */
  412. /**
  413. * @deprecated Legacy API
  414. * @brief Assign a name and type to a sync object using char or Unicode string
  415. * @param[in] addr - pointer to the sync object. You should use a real pointer to your object
  416. * to make sure that the values don't clash with other object addresses
  417. * @param[in] objtype - null-terminated object type string. If NULL is passed, the object will
  418. * be assumed to be of generic "User Synchronization" type
  419. * @param[in] objname - null-terminated object name string. If NULL, no name will be assigned
  420. * to the object -- you can use the __itt_sync_rename call later to assign
  421. * the name
  422. * @param[in] typelen, namelen - a length of string for appropriate objtype and objname parameter
  423. * @param[in] attribute - one of [#__itt_attr_barrier, #__itt_attr_mutex] values which defines the
  424. * exact semantics of how prepare/acquired/releasing calls work.
  425. * @return __itt_err upon failure (name or namelen being null,name and namelen mismatched)
  426. */
  427. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  428. int LIBITTAPI __itt_notify_sync_nameA(void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute);
  429. int LIBITTAPI __itt_notify_sync_nameW(void *addr, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute);
  430. #if defined(UNICODE) || defined(_UNICODE)
  431. # define __itt_notify_sync_name __itt_notify_sync_nameW
  432. #else
  433. # define __itt_notify_sync_name __itt_notify_sync_nameA
  434. #endif
  435. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  436. int LIBITTAPI __itt_notify_sync_name(void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute);
  437. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  438. /** @cond exclude_from_documentation */
  439. #ifndef INTEL_NO_MACRO_BODY
  440. #ifndef INTEL_NO_ITTNOTIFY_API
  441. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  442. ITT_STUB(LIBITTAPI, int, notify_sync_nameA, (void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute))
  443. ITT_STUB(LIBITTAPI, int, notify_sync_nameW, (void *addr, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute))
  444. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  445. ITT_STUB(LIBITTAPI, int, notify_sync_name, (void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute))
  446. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  447. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  448. #define __itt_notify_sync_nameA ITTNOTIFY_DATA(notify_sync_nameA)
  449. #define __itt_notify_sync_nameA_ptr ITTNOTIFY_NAME(notify_sync_nameA)
  450. #define __itt_notify_sync_nameW ITTNOTIFY_DATA(notify_sync_nameW)
  451. #define __itt_notify_sync_nameW_ptr ITTNOTIFY_NAME(notify_sync_nameW)
  452. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  453. #define __itt_notify_sync_name ITTNOTIFY_DATA(notify_sync_name)
  454. #define __itt_notify_sync_name_ptr ITTNOTIFY_NAME(notify_sync_name)
  455. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  456. #else /* INTEL_NO_ITTNOTIFY_API */
  457. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  458. #define __itt_notify_sync_nameA(addr, objtype, typelen, objname, namelen, attribute)
  459. #define __itt_notify_sync_nameA_ptr 0
  460. #define __itt_notify_sync_nameW(addr, objtype, typelen, objname, namelen, attribute)
  461. #define __itt_notify_sync_nameW_ptr 0
  462. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  463. #define __itt_notify_sync_name(addr, objtype, typelen, objname, namelen, attribute)
  464. #define __itt_notify_sync_name_ptr 0
  465. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  466. #endif /* INTEL_NO_ITTNOTIFY_API */
  467. #else /* INTEL_NO_MACRO_BODY */
  468. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  469. #define __itt_notify_sync_nameA_ptr 0
  470. #define __itt_notify_sync_nameW_ptr 0
  471. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  472. #define __itt_notify_sync_name_ptr 0
  473. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  474. #endif /* INTEL_NO_MACRO_BODY */
  475. /** @endcond */
  476. /**
  477. * @deprecated Legacy API
  478. * @brief Enter spin loop on user-defined sync object
  479. */
  480. void LIBITTAPI __itt_notify_sync_prepare(void* addr);
  481. /** @cond exclude_from_documentation */
  482. #ifndef INTEL_NO_MACRO_BODY
  483. #ifndef INTEL_NO_ITTNOTIFY_API
  484. ITT_STUBV(LIBITTAPI, void, notify_sync_prepare, (void *addr))
  485. #define __itt_notify_sync_prepare ITTNOTIFY_VOID(notify_sync_prepare)
  486. #define __itt_notify_sync_prepare_ptr ITTNOTIFY_NAME(notify_sync_prepare)
  487. #else /* INTEL_NO_ITTNOTIFY_API */
  488. #define __itt_notify_sync_prepare(addr)
  489. #define __itt_notify_sync_prepare_ptr 0
  490. #endif /* INTEL_NO_ITTNOTIFY_API */
  491. #else /* INTEL_NO_MACRO_BODY */
  492. #define __itt_notify_sync_prepare_ptr 0
  493. #endif /* INTEL_NO_MACRO_BODY */
  494. /** @endcond */
  495. /**
  496. * @deprecated Legacy API
  497. * @brief Quit spin loop without acquiring spin object
  498. */
  499. void LIBITTAPI __itt_notify_sync_cancel(void *addr);
  500. /** @cond exclude_from_documentation */
  501. #ifndef INTEL_NO_MACRO_BODY
  502. #ifndef INTEL_NO_ITTNOTIFY_API
  503. ITT_STUBV(LIBITTAPI, void, notify_sync_cancel, (void *addr))
  504. #define __itt_notify_sync_cancel ITTNOTIFY_VOID(notify_sync_cancel)
  505. #define __itt_notify_sync_cancel_ptr ITTNOTIFY_NAME(notify_sync_cancel)
  506. #else /* INTEL_NO_ITTNOTIFY_API */
  507. #define __itt_notify_sync_cancel(addr)
  508. #define __itt_notify_sync_cancel_ptr 0
  509. #endif /* INTEL_NO_ITTNOTIFY_API */
  510. #else /* INTEL_NO_MACRO_BODY */
  511. #define __itt_notify_sync_cancel_ptr 0
  512. #endif /* INTEL_NO_MACRO_BODY */
  513. /** @endcond */
  514. /**
  515. * @deprecated Legacy API
  516. * @brief Successful spin loop completion (sync object acquired)
  517. */
  518. void LIBITTAPI __itt_notify_sync_acquired(void *addr);
  519. /** @cond exclude_from_documentation */
  520. #ifndef INTEL_NO_MACRO_BODY
  521. #ifndef INTEL_NO_ITTNOTIFY_API
  522. ITT_STUBV(LIBITTAPI, void, notify_sync_acquired, (void *addr))
  523. #define __itt_notify_sync_acquired ITTNOTIFY_VOID(notify_sync_acquired)
  524. #define __itt_notify_sync_acquired_ptr ITTNOTIFY_NAME(notify_sync_acquired)
  525. #else /* INTEL_NO_ITTNOTIFY_API */
  526. #define __itt_notify_sync_acquired(addr)
  527. #define __itt_notify_sync_acquired_ptr 0
  528. #endif /* INTEL_NO_ITTNOTIFY_API */
  529. #else /* INTEL_NO_MACRO_BODY */
  530. #define __itt_notify_sync_acquired_ptr 0
  531. #endif /* INTEL_NO_MACRO_BODY */
  532. /** @endcond */
  533. /**
  534. * @deprecated Legacy API
  535. * @brief Start sync object releasing code. Is called before the lock release call.
  536. */
  537. void LIBITTAPI __itt_notify_sync_releasing(void* addr);
  538. /** @cond exclude_from_documentation */
  539. #ifndef INTEL_NO_MACRO_BODY
  540. #ifndef INTEL_NO_ITTNOTIFY_API
  541. ITT_STUBV(LIBITTAPI, void, notify_sync_releasing, (void *addr))
  542. #define __itt_notify_sync_releasing ITTNOTIFY_VOID(notify_sync_releasing)
  543. #define __itt_notify_sync_releasing_ptr ITTNOTIFY_NAME(notify_sync_releasing)
  544. #else /* INTEL_NO_ITTNOTIFY_API */
  545. #define __itt_notify_sync_releasing(addr)
  546. #define __itt_notify_sync_releasing_ptr 0
  547. #endif /* INTEL_NO_ITTNOTIFY_API */
  548. #else /* INTEL_NO_MACRO_BODY */
  549. #define __itt_notify_sync_releasing_ptr 0
  550. #endif /* INTEL_NO_MACRO_BODY */
  551. /** @endcond */
  552. /** @} legacy_sync group */
  553. #ifndef _ITTNOTIFY_H_
  554. /**
  555. * @defgroup legacy_events Events
  556. * @ingroup legacy
  557. * Events group
  558. * @{
  559. */
  560. /** @brief user event type */
  561. typedef int __itt_event;
  562. /**
  563. * @brief Create an event notification
  564. * @note name or namelen being null/name and namelen not matching, user event feature not enabled
  565. * @return non-zero event identifier upon success and __itt_err otherwise
  566. */
  567. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  568. __itt_event LIBITTAPI __itt_event_createA(const char *name, int namelen);
  569. __itt_event LIBITTAPI __itt_event_createW(const wchar_t *name, int namelen);
  570. #if defined(UNICODE) || defined(_UNICODE)
  571. # define __itt_event_create __itt_event_createW
  572. # define __itt_event_create_ptr __itt_event_createW_ptr
  573. #else
  574. # define __itt_event_create __itt_event_createA
  575. # define __itt_event_create_ptr __itt_event_createA_ptr
  576. #endif /* UNICODE */
  577. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  578. __itt_event LIBITTAPI __itt_event_create(const char *name, int namelen);
  579. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  580. /** @cond exclude_from_documentation */
  581. #ifndef INTEL_NO_MACRO_BODY
  582. #ifndef INTEL_NO_ITTNOTIFY_API
  583. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  584. ITT_STUB(LIBITTAPI, __itt_event, event_createA, (const char *name, int namelen))
  585. ITT_STUB(LIBITTAPI, __itt_event, event_createW, (const wchar_t *name, int namelen))
  586. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  587. ITT_STUB(LIBITTAPI, __itt_event, event_create, (const char *name, int namelen))
  588. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  589. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  590. #define __itt_event_createA ITTNOTIFY_DATA(event_createA)
  591. #define __itt_event_createA_ptr ITTNOTIFY_NAME(event_createA)
  592. #define __itt_event_createW ITTNOTIFY_DATA(event_createW)
  593. #define __itt_event_createW_ptr ITTNOTIFY_NAME(event_createW)
  594. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  595. #define __itt_event_create ITTNOTIFY_DATA(event_create)
  596. #define __itt_event_create_ptr ITTNOTIFY_NAME(event_create)
  597. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  598. #else /* INTEL_NO_ITTNOTIFY_API */
  599. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  600. #define __itt_event_createA(name, namelen) (__itt_event)0
  601. #define __itt_event_createA_ptr 0
  602. #define __itt_event_createW(name, namelen) (__itt_event)0
  603. #define __itt_event_createW_ptr 0
  604. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  605. #define __itt_event_create(name, namelen) (__itt_event)0
  606. #define __itt_event_create_ptr 0
  607. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  608. #endif /* INTEL_NO_ITTNOTIFY_API */
  609. #else /* INTEL_NO_MACRO_BODY */
  610. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  611. #define __itt_event_createA_ptr 0
  612. #define __itt_event_createW_ptr 0
  613. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  614. #define __itt_event_create_ptr 0
  615. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  616. #endif /* INTEL_NO_MACRO_BODY */
  617. /** @endcond */
  618. /**
  619. * @brief Record an event occurrence.
  620. * @return __itt_err upon failure (invalid event id/user event feature not enabled)
  621. */
  622. int LIBITTAPI __itt_event_start(__itt_event event);
  623. /** @cond exclude_from_documentation */
  624. #ifndef INTEL_NO_MACRO_BODY
  625. #ifndef INTEL_NO_ITTNOTIFY_API
  626. ITT_STUB(LIBITTAPI, int, event_start, (__itt_event event))
  627. #define __itt_event_start ITTNOTIFY_DATA(event_start)
  628. #define __itt_event_start_ptr ITTNOTIFY_NAME(event_start)
  629. #else /* INTEL_NO_ITTNOTIFY_API */
  630. #define __itt_event_start(event) (int)0
  631. #define __itt_event_start_ptr 0
  632. #endif /* INTEL_NO_ITTNOTIFY_API */
  633. #else /* INTEL_NO_MACRO_BODY */
  634. #define __itt_event_start_ptr 0
  635. #endif /* INTEL_NO_MACRO_BODY */
  636. /** @endcond */
  637. /**
  638. * @brief Record an event end occurrence.
  639. * @note It is optional if events do not have durations.
  640. * @return __itt_err upon failure (invalid event id/user event feature not enabled)
  641. */
  642. int LIBITTAPI __itt_event_end(__itt_event event);
  643. /** @cond exclude_from_documentation */
  644. #ifndef INTEL_NO_MACRO_BODY
  645. #ifndef INTEL_NO_ITTNOTIFY_API
  646. ITT_STUB(LIBITTAPI, int, event_end, (__itt_event event))
  647. #define __itt_event_end ITTNOTIFY_DATA(event_end)
  648. #define __itt_event_end_ptr ITTNOTIFY_NAME(event_end)
  649. #else /* INTEL_NO_ITTNOTIFY_API */
  650. #define __itt_event_end(event) (int)0
  651. #define __itt_event_end_ptr 0
  652. #endif /* INTEL_NO_ITTNOTIFY_API */
  653. #else /* INTEL_NO_MACRO_BODY */
  654. #define __itt_event_end_ptr 0
  655. #endif /* INTEL_NO_MACRO_BODY */
  656. /** @endcond */
  657. /** @} legacy_events group */
  658. #endif /* _ITTNOTIFY_H_ */
  659. /**
  660. * @defgroup legacy_memory Memory Accesses
  661. * @ingroup legacy
  662. */
  663. /**
  664. * @deprecated Legacy API
  665. * @brief Inform the tool of memory accesses on reading
  666. */
  667. void LIBITTAPI __itt_memory_read(void *addr, size_t size);
  668. /** @cond exclude_from_documentation */
  669. #ifndef INTEL_NO_MACRO_BODY
  670. #ifndef INTEL_NO_ITTNOTIFY_API
  671. ITT_STUBV(LIBITTAPI, void, memory_read, (void *addr, size_t size))
  672. #define __itt_memory_read ITTNOTIFY_VOID(memory_read)
  673. #define __itt_memory_read_ptr ITTNOTIFY_NAME(memory_read)
  674. #else /* INTEL_NO_ITTNOTIFY_API */
  675. #define __itt_memory_read(addr, size)
  676. #define __itt_memory_read_ptr 0
  677. #endif /* INTEL_NO_ITTNOTIFY_API */
  678. #else /* INTEL_NO_MACRO_BODY */
  679. #define __itt_memory_read_ptr 0
  680. #endif /* INTEL_NO_MACRO_BODY */
  681. /** @endcond */
  682. /**
  683. * @deprecated Legacy API
  684. * @brief Inform the tool of memory accesses on writing
  685. */
  686. void LIBITTAPI __itt_memory_write(void *addr, size_t size);
  687. /** @cond exclude_from_documentation */
  688. #ifndef INTEL_NO_MACRO_BODY
  689. #ifndef INTEL_NO_ITTNOTIFY_API
  690. ITT_STUBV(LIBITTAPI, void, memory_write, (void *addr, size_t size))
  691. #define __itt_memory_write ITTNOTIFY_VOID(memory_write)
  692. #define __itt_memory_write_ptr ITTNOTIFY_NAME(memory_write)
  693. #else /* INTEL_NO_ITTNOTIFY_API */
  694. #define __itt_memory_write(addr, size)
  695. #define __itt_memory_write_ptr 0
  696. #endif /* INTEL_NO_ITTNOTIFY_API */
  697. #else /* INTEL_NO_MACRO_BODY */
  698. #define __itt_memory_write_ptr 0
  699. #endif /* INTEL_NO_MACRO_BODY */
  700. /** @endcond */
  701. /**
  702. * @deprecated Legacy API
  703. * @brief Inform the tool of memory accesses on updating
  704. */
  705. void LIBITTAPI __itt_memory_update(void *address, size_t size);
  706. /** @cond exclude_from_documentation */
  707. #ifndef INTEL_NO_MACRO_BODY
  708. #ifndef INTEL_NO_ITTNOTIFY_API
  709. ITT_STUBV(LIBITTAPI, void, memory_update, (void *addr, size_t size))
  710. #define __itt_memory_update ITTNOTIFY_VOID(memory_update)
  711. #define __itt_memory_update_ptr ITTNOTIFY_NAME(memory_update)
  712. #else /* INTEL_NO_ITTNOTIFY_API */
  713. #define __itt_memory_update(addr, size)
  714. #define __itt_memory_update_ptr 0
  715. #endif /* INTEL_NO_ITTNOTIFY_API */
  716. #else /* INTEL_NO_MACRO_BODY */
  717. #define __itt_memory_update_ptr 0
  718. #endif /* INTEL_NO_MACRO_BODY */
  719. /** @endcond */
  720. /** @} legacy_memory group */
  721. /**
  722. * @defgroup legacy_state Thread and Object States
  723. * @ingroup legacy
  724. */
  725. /** @brief state type */
  726. typedef int __itt_state_t;
  727. /** @cond exclude_from_documentation */
  728. typedef enum __itt_obj_state {
  729. __itt_obj_state_err = 0,
  730. __itt_obj_state_clr = 1,
  731. __itt_obj_state_set = 2,
  732. __itt_obj_state_use = 3
  733. } __itt_obj_state_t;
  734. typedef enum __itt_thr_state {
  735. __itt_thr_state_err = 0,
  736. __itt_thr_state_clr = 1,
  737. __itt_thr_state_set = 2
  738. } __itt_thr_state_t;
  739. typedef enum __itt_obj_prop {
  740. __itt_obj_prop_watch = 1,
  741. __itt_obj_prop_ignore = 2,
  742. __itt_obj_prop_sharable = 3
  743. } __itt_obj_prop_t;
  744. typedef enum __itt_thr_prop {
  745. __itt_thr_prop_quiet = 1
  746. } __itt_thr_prop_t;
  747. /** @endcond */
  748. /**
  749. * @deprecated Legacy API
  750. * @brief managing thread and object states
  751. */
  752. __itt_state_t LIBITTAPI __itt_state_get(void);
  753. /** @cond exclude_from_documentation */
  754. #ifndef INTEL_NO_MACRO_BODY
  755. #ifndef INTEL_NO_ITTNOTIFY_API
  756. ITT_STUB(ITTAPI, __itt_state_t, state_get, (void))
  757. #define __itt_state_get ITTNOTIFY_DATA(state_get)
  758. #define __itt_state_get_ptr ITTNOTIFY_NAME(state_get)
  759. #else /* INTEL_NO_ITTNOTIFY_API */
  760. #define __itt_state_get(void) (__itt_state_t)0
  761. #define __itt_state_get_ptr 0
  762. #endif /* INTEL_NO_ITTNOTIFY_API */
  763. #else /* INTEL_NO_MACRO_BODY */
  764. #define __itt_state_get_ptr 0
  765. #endif /* INTEL_NO_MACRO_BODY */
  766. /** @endcond */
  767. /**
  768. * @deprecated Legacy API
  769. * @brief managing thread and object states
  770. */
  771. __itt_state_t LIBITTAPI __itt_state_set(__itt_state_t s);
  772. /** @cond exclude_from_documentation */
  773. #ifndef INTEL_NO_MACRO_BODY
  774. #ifndef INTEL_NO_ITTNOTIFY_API
  775. ITT_STUB(ITTAPI, __itt_state_t, state_set, (__itt_state_t s))
  776. #define __itt_state_set ITTNOTIFY_DATA(state_set)
  777. #define __itt_state_set_ptr ITTNOTIFY_NAME(state_set)
  778. #else /* INTEL_NO_ITTNOTIFY_API */
  779. #define __itt_state_set(s) (__itt_state_t)0
  780. #define __itt_state_set_ptr 0
  781. #endif /* INTEL_NO_ITTNOTIFY_API */
  782. #else /* INTEL_NO_MACRO_BODY */
  783. #define __itt_state_set_ptr 0
  784. #endif /* INTEL_NO_MACRO_BODY */
  785. /** @endcond */
  786. /**
  787. * @deprecated Legacy API
  788. * @brief managing thread and object modes
  789. */
  790. __itt_thr_state_t LIBITTAPI __itt_thr_mode_set(__itt_thr_prop_t p, __itt_thr_state_t s);
  791. /** @cond exclude_from_documentation */
  792. #ifndef INTEL_NO_MACRO_BODY
  793. #ifndef INTEL_NO_ITTNOTIFY_API
  794. ITT_STUB(ITTAPI, __itt_thr_state_t, thr_mode_set, (__itt_thr_prop_t p, __itt_thr_state_t s))
  795. #define __itt_thr_mode_set ITTNOTIFY_DATA(thr_mode_set)
  796. #define __itt_thr_mode_set_ptr ITTNOTIFY_NAME(thr_mode_set)
  797. #else /* INTEL_NO_ITTNOTIFY_API */
  798. #define __itt_thr_mode_set(p, s) (__itt_thr_state_t)0
  799. #define __itt_thr_mode_set_ptr 0
  800. #endif /* INTEL_NO_ITTNOTIFY_API */
  801. #else /* INTEL_NO_MACRO_BODY */
  802. #define __itt_thr_mode_set_ptr 0
  803. #endif /* INTEL_NO_MACRO_BODY */
  804. /** @endcond */
  805. /**
  806. * @deprecated Legacy API
  807. * @brief managing thread and object modes
  808. */
  809. __itt_obj_state_t LIBITTAPI __itt_obj_mode_set(__itt_obj_prop_t p, __itt_obj_state_t s);
  810. /** @cond exclude_from_documentation */
  811. #ifndef INTEL_NO_MACRO_BODY
  812. #ifndef INTEL_NO_ITTNOTIFY_API
  813. ITT_STUB(ITTAPI, __itt_obj_state_t, obj_mode_set, (__itt_obj_prop_t p, __itt_obj_state_t s))
  814. #define __itt_obj_mode_set ITTNOTIFY_DATA(obj_mode_set)
  815. #define __itt_obj_mode_set_ptr ITTNOTIFY_NAME(obj_mode_set)
  816. #else /* INTEL_NO_ITTNOTIFY_API */
  817. #define __itt_obj_mode_set(p, s) (__itt_obj_state_t)0
  818. #define __itt_obj_mode_set_ptr 0
  819. #endif /* INTEL_NO_ITTNOTIFY_API */
  820. #else /* INTEL_NO_MACRO_BODY */
  821. #define __itt_obj_mode_set_ptr 0
  822. #endif /* INTEL_NO_MACRO_BODY */
  823. /** @endcond */
  824. /** @} legacy_state group */
  825. /**
  826. * @defgroup frames Frames
  827. * @ingroup legacy
  828. * Frames group
  829. * @{
  830. */
  831. /**
  832. * @brief opaque structure for frame identification
  833. */
  834. typedef struct __itt_frame_t *__itt_frame;
  835. /**
  836. * @brief Create a global frame with given domain
  837. */
  838. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  839. __itt_frame ITTAPI __itt_frame_createA(const char *domain);
  840. __itt_frame ITTAPI __itt_frame_createW(const wchar_t *domain);
  841. #if defined(UNICODE) || defined(_UNICODE)
  842. # define __itt_frame_create __itt_frame_createW
  843. # define __itt_frame_create_ptr __itt_frame_createW_ptr
  844. #else /* UNICODE */
  845. # define __itt_frame_create __itt_frame_createA
  846. # define __itt_frame_create_ptr __itt_frame_createA_ptr
  847. #endif /* UNICODE */
  848. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  849. __itt_frame ITTAPI __itt_frame_create(const char *domain);
  850. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  851. /** @cond exclude_from_documentation */
  852. #ifndef INTEL_NO_MACRO_BODY
  853. #ifndef INTEL_NO_ITTNOTIFY_API
  854. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  855. ITT_STUB(ITTAPI, __itt_frame, frame_createA, (const char *domain))
  856. ITT_STUB(ITTAPI, __itt_frame, frame_createW, (const wchar_t *domain))
  857. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  858. ITT_STUB(ITTAPI, __itt_frame, frame_create, (const char *domain))
  859. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  860. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  861. #define __itt_frame_createA ITTNOTIFY_DATA(frame_createA)
  862. #define __itt_frame_createA_ptr ITTNOTIFY_NAME(frame_createA)
  863. #define __itt_frame_createW ITTNOTIFY_DATA(frame_createW)
  864. #define __itt_frame_createW_ptr ITTNOTIFY_NAME(frame_createW)
  865. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  866. #define __itt_frame_create ITTNOTIFY_DATA(frame_create)
  867. #define __itt_frame_create_ptr ITTNOTIFY_NAME(frame_create)
  868. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  869. #else /* INTEL_NO_ITTNOTIFY_API */
  870. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  871. #define __itt_frame_createA(domain)
  872. #define __itt_frame_createA_ptr 0
  873. #define __itt_frame_createW(domain)
  874. #define __itt_frame_createW_ptr 0
  875. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  876. #define __itt_frame_create(domain)
  877. #define __itt_frame_create_ptr 0
  878. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  879. #endif /* INTEL_NO_ITTNOTIFY_API */
  880. #else /* INTEL_NO_MACRO_BODY */
  881. #if ITT_PLATFORM==ITT_PLATFORM_WIN
  882. #define __itt_frame_createA_ptr 0
  883. #define __itt_frame_createW_ptr 0
  884. #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  885. #define __itt_frame_create_ptr 0
  886. #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
  887. #endif /* INTEL_NO_MACRO_BODY */
  888. /** @endcond */
  889. /** @brief Record a frame begin occurrence. */
  890. void ITTAPI __itt_frame_begin(__itt_frame frame);
  891. /** @brief Record a frame end occurrence. */
  892. void ITTAPI __itt_frame_end (__itt_frame frame);
  893. /** @cond exclude_from_documentation */
  894. #ifndef INTEL_NO_MACRO_BODY
  895. #ifndef INTEL_NO_ITTNOTIFY_API
  896. ITT_STUBV(ITTAPI, void, frame_begin, (__itt_frame frame))
  897. ITT_STUBV(ITTAPI, void, frame_end, (__itt_frame frame))
  898. #define __itt_frame_begin ITTNOTIFY_VOID(frame_begin)
  899. #define __itt_frame_begin_ptr ITTNOTIFY_NAME(frame_begin)
  900. #define __itt_frame_end ITTNOTIFY_VOID(frame_end)
  901. #define __itt_frame_end_ptr ITTNOTIFY_NAME(frame_end)
  902. #else /* INTEL_NO_ITTNOTIFY_API */
  903. #define __itt_frame_begin(frame)
  904. #define __itt_frame_begin_ptr 0
  905. #define __itt_frame_end(frame)
  906. #define __itt_frame_end_ptr 0
  907. #endif /* INTEL_NO_ITTNOTIFY_API */
  908. #else /* INTEL_NO_MACRO_BODY */
  909. #define __itt_frame_begin_ptr 0
  910. #define __itt_frame_end_ptr 0
  911. #endif /* INTEL_NO_MACRO_BODY */
  912. /** @endcond */
  913. /** @} frames group */
  914. #ifdef __cplusplus
  915. }
  916. #endif /* __cplusplus */
  917. #endif /* _LEGACY_ITTNOTIFY_H_ */
  918. #else
  919. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  920. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)