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