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