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