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