Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
ittnotify_static.c
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005-2019 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 #include "ittnotify_config.h"
18 
19 #if ITT_PLATFORM==ITT_PLATFORM_WIN
20 #define PATH_MAX 512
21 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
22 #include <limits.h>
23 #include <dlfcn.h>
24 #include <errno.h>
25 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <stdarg.h>
29 #include <string.h>
30 
31 #define INTEL_NO_MACRO_BODY
32 #define INTEL_ITTNOTIFY_API_PRIVATE
33 #include "ittnotify.h"
34 #include "legacy/ittnotify.h"
35 
36 #include "disable_warnings.h"
37 
38 static const char api_version[] = API_VERSION "\0\n@(#) $Revision: 413915 $\n";
39 
40 #define _N_(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n)
41 
42 #if ITT_OS==ITT_OS_WIN
43 static const char* ittnotify_lib_name = "libittnotify.dll";
44 #elif ITT_OS==ITT_OS_LINUX || ITT_OS==ITT_OS_FREEBSD
45 static const char* ittnotify_lib_name = "libittnotify.so";
46 #elif ITT_OS==ITT_OS_MAC
47 static const char* ittnotify_lib_name = "libittnotify.dylib";
48 #else
49 #error Unsupported or unknown OS.
50 #endif
51 
52 #ifdef __ANDROID__
53 #include <android/log.h>
54 #include <stdio.h>
55 #include <unistd.h>
56 #include <sys/types.h>
57 #include <sys/stat.h>
58 #include <fcntl.h>
59 #include <linux/limits.h>
60 
61 #ifdef ITT_ANDROID_LOG
62  #define ITT_ANDROID_LOG_TAG "INTEL_VTUNE_USERAPI"
63  #define ITT_ANDROID_LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, ITT_ANDROID_LOG_TAG, __VA_ARGS__))
64  #define ITT_ANDROID_LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, ITT_ANDROID_LOG_TAG, __VA_ARGS__))
65  #define ITT_ANDROID_LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR,ITT_ANDROID_LOG_TAG, __VA_ARGS__))
66  #define ITT_ANDROID_LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG,ITT_ANDROID_LOG_TAG, __VA_ARGS__))
67 #else
68  #define ITT_ANDROID_LOGI(...)
69  #define ITT_ANDROID_LOGW(...)
70  #define ITT_ANDROID_LOGE(...)
71  #define ITT_ANDROID_LOGD(...)
72 #endif
73 
74 /* default location of userapi collector on Android */
75 #define ANDROID_ITTNOTIFY_DEFAULT_PATH_MASK(x) "/data/data/com.intel.vtune/perfrun/lib" \
76  #x "/runtime/libittnotify.so"
77 
78 #if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM
79 #define ANDROID_ITTNOTIFY_DEFAULT_PATH ANDROID_ITTNOTIFY_DEFAULT_PATH_MASK(32)
80 #else
81 #define ANDROID_ITTNOTIFY_DEFAULT_PATH ANDROID_ITTNOTIFY_DEFAULT_PATH_MASK(64)
82 #endif
83 
84 #endif
85 
86 
87 #ifndef LIB_VAR_NAME
88 #if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM
89 #define LIB_VAR_NAME INTEL_LIBITTNOTIFY32
90 #else
91 #define LIB_VAR_NAME INTEL_LIBITTNOTIFY64
92 #endif
93 #endif /* LIB_VAR_NAME */
94 
95 #define ITT_MUTEX_INIT_AND_LOCK(p) { \
96  if (!p.mutex_initialized) \
97  { \
98  if (__itt_interlocked_increment(&p.atomic_counter) == 1) \
99  { \
100  __itt_mutex_init(&p.mutex); \
101  p.mutex_initialized = 1; \
102  } \
103  else \
104  while (!p.mutex_initialized) \
105  __itt_thread_yield(); \
106  } \
107  __itt_mutex_lock(&p.mutex); \
108 }
109 
110 const int _N_(err) = 0;
111 
112 typedef int (__itt_init_ittlib_t)(const char*, __itt_group_id);
113 
114 /* this define used to control initialization function name. */
115 #ifndef __itt_init_ittlib_name
116 ITT_EXTERN_C int _N_(init_ittlib)(const char*, __itt_group_id);
118 #define __itt_init_ittlib_name __itt_init_ittlib_ptr
119 #endif /* __itt_init_ittlib_name */
120 
122 
123 /* this define used to control finalization function name. */
124 #ifndef __itt_fini_ittlib_name
127 #define __itt_fini_ittlib_name __itt_fini_ittlib_ptr
128 #endif /* __itt_fini_ittlib_name */
129 
130 /* building pointers to imported funcs */
131 #undef ITT_STUBV
132 #undef ITT_STUB
133 #define ITT_STUB(api,type,name,args,params,ptr,group,format) \
134 static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
135 typedef type api ITT_JOIN(_N_(name),_t) args; \
136 ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END \
137 static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args \
138 { \
139  __itt_init_ittlib_name(NULL, __itt_group_all); \
140  if (ITTNOTIFY_NAME(name) && ITTNOTIFY_NAME(name) != ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init))) \
141  return ITTNOTIFY_NAME(name) params; \
142  else \
143  return (type)0; \
144 }
145 
146 #define ITT_STUBV(api,type,name,args,params,ptr,group,format) \
147 static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
148 typedef type api ITT_JOIN(_N_(name),_t) args; \
149 ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END \
150 static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args \
151 { \
152  __itt_init_ittlib_name(NULL, __itt_group_all); \
153  if (ITTNOTIFY_NAME(name) && ITTNOTIFY_NAME(name) != ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init))) \
154  ITTNOTIFY_NAME(name) params; \
155  else \
156  return; \
157 }
158 
159 #undef __ITT_INTERNAL_INIT
160 #include "ittnotify_static.h"
161 
162 #undef ITT_STUB
163 #undef ITT_STUBV
164 #define ITT_STUB(api,type,name,args,params,ptr,group,format) \
165 static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
166 typedef type api ITT_JOIN(_N_(name),_t) args; \
167 ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END
168 
169 #define ITT_STUBV(api,type,name,args,params,ptr,group,format) \
170 static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
171 typedef type api ITT_JOIN(_N_(name),_t) args; \
172 ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END
173 
174 #define __ITT_INTERNAL_INIT
175 #include "ittnotify_static.h"
176 #undef __ITT_INTERNAL_INIT
177 
178 ITT_GROUP_LIST(group_list);
179 
180 #pragma pack(push, 8)
181 
182 typedef struct ___itt_group_alias
183 {
184  const char* env_var;
187 
191  { NULL, (__itt_group_none) },
192  { api_version, (__itt_group_none) } /* !!! Just to avoid unused code elimination !!! */
193 };
194 
195 #pragma pack(pop)
196 
197 #if ITT_PLATFORM==ITT_PLATFORM_WIN
198 #pragma warning(push)
199 #pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */
200 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
201 
203 /* Define functions with static implementation */
204 #undef ITT_STUB
205 #undef ITT_STUBV
206 #define ITT_STUB(api,type,name,args,params,nameindll,group,format) { ITT_TO_STR(ITT_JOIN(__itt_,nameindll)), (void**)(void*)&ITTNOTIFY_NAME(name), (void*)(size_t)&ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)), (void*)(size_t)&ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)), (__itt_group_id)(group)},
207 #define ITT_STUBV ITT_STUB
208 #define __ITT_INTERNAL_INIT
209 #include "ittnotify_static.h"
210 #undef __ITT_INTERNAL_INIT
211 /* Define functions without static implementation */
212 #undef ITT_STUB
213 #undef ITT_STUBV
214 #define ITT_STUB(api,type,name,args,params,nameindll,group,format) {ITT_TO_STR(ITT_JOIN(__itt_,nameindll)), (void**)(void*)&ITTNOTIFY_NAME(name), (void*)(size_t)&ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)), NULL, (__itt_group_id)(group)},
215 #define ITT_STUBV ITT_STUB
216 #include "ittnotify_static.h"
217  {NULL, NULL, NULL, NULL, __itt_group_none}
218 };
219 
220 #if ITT_PLATFORM==ITT_PLATFORM_WIN
221 #pragma warning(pop)
222 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
223 
224 static const char dll_path[PATH_MAX] = { 0 };
225 
226 /* static part descriptor which handles. all notification api attributes. */
227 __itt_global _N_(_ittapi_global) = {
228  ITT_MAGIC, /* identification info */
229  ITT_MAJOR, ITT_MINOR, API_VERSION_BUILD, /* version info */
230  0, /* api_initialized */
231  0, /* mutex_initialized */
232  0, /* atomic_counter */
233  MUTEX_INITIALIZER, /* mutex */
234  NULL, /* dynamic library handle */
235  NULL, /* error_handler */
236  (const char**)&dll_path, /* dll_path_ptr */
237  (__itt_api_info*)&api_list, /* api_list_ptr */
238  NULL, /* next __itt_global */
239  NULL, /* thread_list */
240  NULL, /* domain_list */
241  NULL, /* string_list */
242  __itt_collection_normal /* collection state */
243 };
244 
247 
248 /* ========================================================================= */
249 
250 #ifdef ITT_NOTIFY_EXT_REPORT
251 ITT_EXTERN_C void _N_(error_handler)(__itt_error_code, va_list args);
252 #endif /* ITT_NOTIFY_EXT_REPORT */
253 
254 #if ITT_PLATFORM==ITT_PLATFORM_WIN
255 #pragma warning(push)
256 #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */
257 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
258 
259 static void __itt_report_error_impl(int code, ...) {
260  va_list args;
261  va_start(args, code);
262  if (_N_(_ittapi_global).error_handler != NULL)
263  {
264  __itt_error_handler_t* handler = (__itt_error_handler_t*)(size_t)_N_(_ittapi_global).error_handler;
265  handler((__itt_error_code)code, args);
266  }
267 #ifdef ITT_NOTIFY_EXT_REPORT
268  _N_(error_handler)(code, args);
269 #endif /* ITT_NOTIFY_EXT_REPORT */
270  va_end(args);
271 }
272 
273 //va_start cannot take enum (__itt_error_code) on clang, so it is necessary to transform it to int
274 #define __itt_report_error(code, ...) \
275  __itt_report_error_impl((int)code,__VA_ARGS__)
276 
277 
278 #if ITT_PLATFORM==ITT_PLATFORM_WIN
279 #pragma warning(pop)
280 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
281 
282 #if ITT_PLATFORM==ITT_PLATFORM_WIN
283 static __itt_domain* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createW),_init))(const wchar_t* name)
284 {
285  __itt_domain *h_tail = NULL, *h = NULL;
286 
287  if (name == NULL)
288  {
289  return NULL;
290  }
291 
292  ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global));
293  if (_N_(_ittapi_global).api_initialized)
294  {
295  if (ITTNOTIFY_NAME(domain_createW) && ITTNOTIFY_NAME(domain_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createW),_init)))
296  {
297  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
298  return ITTNOTIFY_NAME(domain_createW)(name);
299  }
300  }
301  for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next)
302  {
303  if (h->nameW != NULL && !wcscmp(h->nameW, name)) break;
304  }
305  if (h == NULL)
306  {
307  NEW_DOMAIN_W(&_N_(_ittapi_global),h,h_tail,name);
308  }
309  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
310  return h;
311 }
312 
313 static __itt_domain* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createA),_init))(const char* name)
314 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
315 static __itt_domain* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_create),_init))(const char* name)
316 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
317 {
318  __itt_domain *h_tail = NULL, *h = NULL;
319 
320  if (name == NULL)
321  {
322  return NULL;
323  }
324 
325  ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global));
326  if (_N_(_ittapi_global).api_initialized)
327  {
328 #if ITT_PLATFORM==ITT_PLATFORM_WIN
329  if (ITTNOTIFY_NAME(domain_createA) && ITTNOTIFY_NAME(domain_createA) != ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createA),_init)))
330  {
331  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
332  return ITTNOTIFY_NAME(domain_createA)(name);
333  }
334 #else
335  if (ITTNOTIFY_NAME(domain_create) && ITTNOTIFY_NAME(domain_create) != ITT_VERSIONIZE(ITT_JOIN(_N_(domain_create),_init)))
336  {
337  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
338  return ITTNOTIFY_NAME(domain_create)(name);
339  }
340 #endif
341  }
342  for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next)
343  {
344  if (h->nameA != NULL && !__itt_fstrcmp(h->nameA, name)) break;
345  }
346  if (h == NULL)
347  {
348  NEW_DOMAIN_A(&_N_(_ittapi_global),h,h_tail,name);
349  }
350  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
351  return h;
352 }
353 
354 #if ITT_PLATFORM==ITT_PLATFORM_WIN
355 static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init))(const wchar_t* name)
356 {
357  __itt_string_handle *h_tail = NULL, *h = NULL;
358 
359  if (name == NULL)
360  {
361  return NULL;
362  }
363 
364  ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global));
365  if (_N_(_ittapi_global).api_initialized)
366  {
367  if (ITTNOTIFY_NAME(string_handle_createW) && ITTNOTIFY_NAME(string_handle_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init)))
368  {
369  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
370  return ITTNOTIFY_NAME(string_handle_createW)(name);
371  }
372  }
373  for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next)
374  {
375  if (h->strW != NULL && !wcscmp(h->strW, name)) break;
376  }
377  if (h == NULL)
378  {
379  NEW_STRING_HANDLE_W(&_N_(_ittapi_global),h,h_tail,name);
380  }
381  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
382  return h;
383 }
384 
385 static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createA),_init))(const char* name)
386 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
387 static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_create),_init))(const char* name)
388 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
389 {
390  __itt_string_handle *h_tail = NULL, *h = NULL;
391 
392  if (name == NULL)
393  {
394  return NULL;
395  }
396 
397  ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global));
398  if (_N_(_ittapi_global).api_initialized)
399  {
400 #if ITT_PLATFORM==ITT_PLATFORM_WIN
401  if (ITTNOTIFY_NAME(string_handle_createA) && ITTNOTIFY_NAME(string_handle_createA) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createA),_init)))
402  {
403  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
404  return ITTNOTIFY_NAME(string_handle_createA)(name);
405  }
406 #else
407  if (ITTNOTIFY_NAME(string_handle_create) && ITTNOTIFY_NAME(string_handle_create) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_create),_init)))
408  {
409  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
410  return ITTNOTIFY_NAME(string_handle_create)(name);
411  }
412 #endif
413  }
414  for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next)
415  {
416  if (h->strA != NULL && !__itt_fstrcmp(h->strA, name)) break;
417  }
418  if (h == NULL)
419  {
420  NEW_STRING_HANDLE_A(&_N_(_ittapi_global),h,h_tail,name);
421  }
422  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
423  return h;
424 }
425 
426 /* -------------------------------------------------------------------------- */
427 
428 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(pause),_init))(void)
429 {
430  if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL)
431  {
433  }
434  if (ITTNOTIFY_NAME(pause) && ITTNOTIFY_NAME(pause) != ITT_VERSIONIZE(ITT_JOIN(_N_(pause),_init)))
435  {
436  ITTNOTIFY_NAME(pause)();
437  }
438  else
439  {
440  _N_(_ittapi_global).state = __itt_collection_paused;
441  }
442 }
443 
444 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(resume),_init))(void)
445 {
446  if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL)
447  {
449  }
450  if (ITTNOTIFY_NAME(resume) && ITTNOTIFY_NAME(resume) != ITT_VERSIONIZE(ITT_JOIN(_N_(resume),_init)))
451  {
452  ITTNOTIFY_NAME(resume)();
453  }
454  else
455  {
456  _N_(_ittapi_global).state = __itt_collection_normal;
457  }
458 }
459 
460 #if ITT_PLATFORM==ITT_PLATFORM_WIN
461 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init))(const wchar_t* name)
462 {
463  if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL)
464  {
466  }
467  if (ITTNOTIFY_NAME(thread_set_nameW) && ITTNOTIFY_NAME(thread_set_nameW) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init)))
468  {
469  ITTNOTIFY_NAME(thread_set_nameW)(name);
470  }
471 }
472 
473 static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_setW),_init))(const wchar_t* name, int namelen)
474 {
475  (void)namelen;
476  ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init))(name);
477  return 0;
478 }
479 
480 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init))(const char* name)
481 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
482 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init))(const char* name)
483 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
484 {
485  if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL)
486  {
488  }
489 #if ITT_PLATFORM==ITT_PLATFORM_WIN
490  if (ITTNOTIFY_NAME(thread_set_nameA) && ITTNOTIFY_NAME(thread_set_nameA) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init)))
491  {
492  ITTNOTIFY_NAME(thread_set_nameA)(name);
493  }
494 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
495  if (ITTNOTIFY_NAME(thread_set_name) && ITTNOTIFY_NAME(thread_set_name) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init)))
496  {
497  ITTNOTIFY_NAME(thread_set_name)(name);
498  }
499 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
500 }
501 
502 #if ITT_PLATFORM==ITT_PLATFORM_WIN
503 static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_setA),_init))(const char* name, int namelen)
504 {
505  (void)namelen;
506  ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init))(name);
507  return 0;
508 }
509 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
510 static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_set),_init))(const char* name, int namelen)
511 {
512  (void)namelen;
513  ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init))(name);
514  return 0;
515 }
516 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
517 
518 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_ignore),_init))(void)
519 {
520  if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL)
521  {
523  }
524  if (ITTNOTIFY_NAME(thread_ignore) && ITTNOTIFY_NAME(thread_ignore) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_ignore),_init)))
525  {
526  ITTNOTIFY_NAME(thread_ignore)();
527  }
528 }
529 
530 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_ignore),_init))(void)
531 {
532  ITT_VERSIONIZE(ITT_JOIN(_N_(thread_ignore),_init))();
533 }
534 
535 static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(enable_attach),_init))(void)
536 {
537 #ifdef __ANDROID__
538  /*
539  * if LIB_VAR_NAME env variable were set before then stay previous value
540  * else set default path
541  */
542  setenv(ITT_TO_STR(LIB_VAR_NAME), ANDROID_ITTNOTIFY_DEFAULT_PATH, 0);
543 #endif
544 }
545 
546 /* -------------------------------------------------------------------------- */
547 
548 static const char* __itt_fsplit(const char* s, const char* sep, const char** out, int* len)
549 {
550  int i;
551  int j;
552 
553  if (!s || !sep || !out || !len)
554  return NULL;
555 
556  for (i = 0; s[i]; i++)
557  {
558  int b = 0;
559  for (j = 0; sep[j]; j++)
560  if (s[i] == sep[j])
561  {
562  b = 1;
563  break;
564  }
565  if (!b)
566  break;
567  }
568 
569  if (!s[i])
570  return NULL;
571 
572  *len = 0;
573  *out = &s[i];
574 
575  for (; s[i]; i++, (*len)++)
576  {
577  int b = 0;
578  for (j = 0; sep[j]; j++)
579  if (s[i] == sep[j])
580  {
581  b = 1;
582  break;
583  }
584  if (b)
585  break;
586  }
587 
588  for (; s[i]; i++)
589  {
590  int b = 0;
591  for (j = 0; sep[j]; j++)
592  if (s[i] == sep[j])
593  {
594  b = 1;
595  break;
596  }
597  if (!b)
598  break;
599  }
600 
601  return &s[i];
602 }
603 
604 /* This function return value of env variable that placed into static buffer.
605  * !!! The same static buffer is used for subsequent calls. !!!
606  * This was done to aviod dynamic allocation for few calls.
607  * Actually we need this function only four times.
608  */
609 static const char* __itt_get_env_var(const char* name)
610 {
611 #define MAX_ENV_VALUE_SIZE 4086
612  static char env_buff[MAX_ENV_VALUE_SIZE];
613  static char* env_value = (char*)env_buff;
614 
615  if (name != NULL)
616  {
617 #if ITT_PLATFORM==ITT_PLATFORM_WIN
618  size_t max_len = MAX_ENV_VALUE_SIZE - (size_t)(env_value - env_buff);
619  DWORD rc = GetEnvironmentVariableA(name, env_value, (DWORD)max_len);
620  if (rc >= max_len)
621  __itt_report_error(__itt_error_env_too_long, name, (size_t)rc - 1, (size_t)(max_len - 1));
622  else if (rc > 0)
623  {
624  const char* ret = (const char*)env_value;
625  env_value += rc + 1;
626  return ret;
627  }
628  else
629  {
630  /* If environment variable is empty, GetEnvirornmentVariables()
631  * returns zero (number of characters (not including terminating null),
632  * and GetLastError() returns ERROR_SUCCESS. */
633  DWORD err = GetLastError();
634  if (err == ERROR_SUCCESS)
635  return env_value;
636 
637  if (err != ERROR_ENVVAR_NOT_FOUND)
638  __itt_report_error(__itt_error_cant_read_env, name, (int)err);
639  }
640 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
641  char* env = getenv(name);
642  if (env != NULL)
643  {
644  size_t len = __itt_fstrnlen(env, MAX_ENV_VALUE_SIZE);
645  size_t max_len = MAX_ENV_VALUE_SIZE - (size_t)(env_value - env_buff);
646  if (len < max_len)
647  {
648  const char* ret = (const char*)env_value;
649  __itt_fstrcpyn(env_value, max_len, env, len + 1);
650  env_value += len + 1;
651  return ret;
652  } else
653  __itt_report_error(__itt_error_env_too_long, name, (size_t)len, (size_t)(max_len - 1));
654  }
655 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
656  }
657  return NULL;
658 }
659 
660 static const char* __itt_get_lib_name(void)
661 {
662  const char* lib_name = __itt_get_env_var(ITT_TO_STR(LIB_VAR_NAME));
663 
664 #ifdef __ANDROID__
665  if (lib_name == NULL)
666  {
667 
668 #if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM
669  const char* const marker_filename = "com.intel.itt.collector_lib_32";
670 #else
671  const char* const marker_filename = "com.intel.itt.collector_lib_64";
672 #endif
673 
674  char system_wide_marker_filename[PATH_MAX] = {0};
675  int itt_marker_file_fd = -1;
676  ssize_t res = 0;
677 
678  res = snprintf(system_wide_marker_filename, PATH_MAX - 1, "%s%s", "/data/local/tmp/", marker_filename);
679  if (res < 0)
680  {
681  ITT_ANDROID_LOGE("Unable to concatenate marker file string.");
682  return lib_name;
683  }
684  itt_marker_file_fd = open(system_wide_marker_filename, O_RDONLY);
685 
686  if (itt_marker_file_fd == -1)
687  {
688  const pid_t my_pid = getpid();
689  char cmdline_path[PATH_MAX] = {0};
690  char package_name[PATH_MAX] = {0};
691  char app_sandbox_file[PATH_MAX] = {0};
692  int cmdline_fd = 0;
693 
694  ITT_ANDROID_LOGI("Unable to open system-wide marker file.");
695  res = snprintf(cmdline_path, PATH_MAX - 1, "/proc/%d/cmdline", my_pid);
696  if (res < 0)
697  {
698  ITT_ANDROID_LOGE("Unable to get cmdline path string.");
699  return lib_name;
700  }
701 
702  ITT_ANDROID_LOGI("CMD file: %s\n", cmdline_path);
703  cmdline_fd = open(cmdline_path, O_RDONLY);
704  if (cmdline_fd == -1)
705  {
706  ITT_ANDROID_LOGE("Unable to open %s file!", cmdline_path);
707  return lib_name;
708  }
709  res = read(cmdline_fd, package_name, PATH_MAX - 1);
710  if (res == -1)
711  {
712  ITT_ANDROID_LOGE("Unable to read %s file!", cmdline_path);
713  res = close(cmdline_fd);
714  if (res == -1)
715  {
716  ITT_ANDROID_LOGE("Unable to close %s file!", cmdline_path);
717  }
718  return lib_name;
719  }
720  res = close(cmdline_fd);
721  if (res == -1)
722  {
723  ITT_ANDROID_LOGE("Unable to close %s file!", cmdline_path);
724  return lib_name;
725  }
726  ITT_ANDROID_LOGI("Package name: %s\n", package_name);
727  res = snprintf(app_sandbox_file, PATH_MAX - 1, "/data/data/%s/%s", package_name, marker_filename);
728  if (res < 0)
729  {
730  ITT_ANDROID_LOGE("Unable to concatenate marker file string.");
731  return lib_name;
732  }
733 
734  ITT_ANDROID_LOGI("Lib marker file name: %s\n", app_sandbox_file);
735  itt_marker_file_fd = open(app_sandbox_file, O_RDONLY);
736  if (itt_marker_file_fd == -1)
737  {
738  ITT_ANDROID_LOGE("Unable to open app marker file!");
739  return lib_name;
740  }
741  }
742 
743  {
744  char itt_lib_name[PATH_MAX] = {0};
745 
746  res = read(itt_marker_file_fd, itt_lib_name, PATH_MAX - 1);
747  if (res == -1)
748  {
749  ITT_ANDROID_LOGE("Unable to read %s file!", itt_marker_file_fd);
750  res = close(itt_marker_file_fd);
751  if (res == -1)
752  {
753  ITT_ANDROID_LOGE("Unable to close %s file!", itt_marker_file_fd);
754  }
755  return lib_name;
756  }
757  ITT_ANDROID_LOGI("ITT Lib path: %s", itt_lib_name);
758  res = close(itt_marker_file_fd);
759  if (res == -1)
760  {
761  ITT_ANDROID_LOGE("Unable to close %s file!", itt_marker_file_fd);
762  return lib_name;
763  }
764  ITT_ANDROID_LOGI("Set env %s to %s", ITT_TO_STR(LIB_VAR_NAME), itt_lib_name);
765  res = setenv(ITT_TO_STR(LIB_VAR_NAME), itt_lib_name, 0);
766  if (res == -1)
767  {
768  ITT_ANDROID_LOGE("Unable to set env var!");
769  return lib_name;
770  }
772  ITT_ANDROID_LOGI("ITT Lib path from env: %s", lib_name);
773  }
774  }
775 #endif
776 
777  return lib_name;
778 }
779 
780 /* Avoid clashes with std::min */
781 #define __itt_min(a,b) ((a) < (b) ? (a) : (b))
782 
784 {
785  int i;
787  const char* var_name = "INTEL_ITTNOTIFY_GROUPS";
788  const char* group_str = __itt_get_env_var(var_name);
789 
790  if (group_str != NULL)
791  {
792  int len;
793  char gr[255];
794  const char* chunk;
795  while ((group_str = __itt_fsplit(group_str, ",; ", &chunk, &len)) != NULL)
796  {
797  __itt_fstrcpyn(gr, sizeof(gr) - 1, chunk, len + 1);
798  gr[__itt_min(len, (int)(sizeof(gr) - 1))] = 0;
799 
800  for (i = 0; group_list[i].name != NULL; i++)
801  {
802  if (!__itt_fstrcmp(gr, group_list[i].name))
803  {
804  res = (__itt_group_id)(res | group_list[i].id);
805  break;
806  }
807  }
808  }
809  /* TODO: !!! Workaround for bug with warning for unknown group !!!
810  * Should be fixed in new initialization scheme.
811  * Now the following groups should be set always. */
812  for (i = 0; group_list[i].id != __itt_group_none; i++)
813  if (group_list[i].id != __itt_group_all &&
814  group_list[i].id > __itt_group_splitter_min &&
815  group_list[i].id < __itt_group_splitter_max)
816  res = (__itt_group_id)(res | group_list[i].id);
817  return res;
818  }
819  else
820  {
821  for (i = 0; group_alias[i].env_var != NULL; i++)
822  if (__itt_get_env_var(group_alias[i].env_var) != NULL)
823  return group_alias[i].groups;
824  }
825 
826  return res;
827 }
828 #undef __itt_min
829 
830 static int __itt_lib_version(lib_t lib)
831 {
832  if (lib == NULL)
833  return 0;
834  if (__itt_get_proc(lib, "__itt_api_init"))
835  return 2;
836  if (__itt_get_proc(lib, "__itt_api_version"))
837  return 1;
838  return 0;
839 }
840 
841 /* It's not used right now! Comment it out to avoid warnings.
842 static void __itt_reinit_all_pointers(void)
843 {
844  int i;
845  // Fill all pointers with initial stubs
846  for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++)
847  *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].init_func;
848 }
849 */
850 
851 static void __itt_nullify_all_pointers(void)
852 {
853  int i;
854  /* Nulify all pointers except domain_create and string_handle_create */
855  for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++)
856  *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func;
857 }
858 
859 #if ITT_PLATFORM==ITT_PLATFORM_WIN
860 #pragma warning(push)
861 #pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */
862 #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */
863 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
864 
866 {
867  __itt_api_fini_t* __itt_api_fini_ptr = NULL;
868  static volatile TIDT current_thread = 0;
869 
870  if (_N_(_ittapi_global).api_initialized)
871  {
872  __itt_mutex_lock(&_N_(_ittapi_global).mutex);
873  if (_N_(_ittapi_global).api_initialized)
874  {
875  if (current_thread == 0)
876  {
877  current_thread = __itt_thread_id();
878  if (_N_(_ittapi_global).lib != NULL)
879  {
880  __itt_api_fini_ptr = (__itt_api_fini_t*)(size_t)__itt_get_proc(_N_(_ittapi_global).lib, "__itt_api_fini");
881  }
882  if (__itt_api_fini_ptr)
883  {
884  __itt_api_fini_ptr(&_N_(_ittapi_global));
885  }
886 
888 
889  /* TODO: !!! not safe !!! don't support unload so far.
890  * if (_N_(_ittapi_global).lib != NULL)
891  * __itt_unload_lib(_N_(_ittapi_global).lib);
892  * _N_(_ittapi_global).lib = NULL;
893  */
894  _N_(_ittapi_global).api_initialized = 0;
895  current_thread = 0;
896  }
897  }
898  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
899  }
900 }
901 
902 ITT_EXTERN_C int _N_(init_ittlib)(const char* lib_name, __itt_group_id init_groups)
903 {
904  int i;
906 #ifdef ITT_COMPLETE_GROUP
907  __itt_group_id zero_group = __itt_group_none;
908 #endif /* ITT_COMPLETE_GROUP */
909  static volatile TIDT current_thread = 0;
910 
911  if (!_N_(_ittapi_global).api_initialized)
912  {
913 #ifndef ITT_SIMPLE_INIT
914  ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global));
915 #endif /* ITT_SIMPLE_INIT */
916 
917  if (!_N_(_ittapi_global).api_initialized)
918  {
919  if (current_thread == 0)
920  {
921  current_thread = __itt_thread_id();
922  if (lib_name == NULL)
923  {
924  lib_name = __itt_get_lib_name();
925  }
926  groups = __itt_get_groups();
927  if (groups != __itt_group_none || lib_name != NULL)
928  {
929  _N_(_ittapi_global).lib = __itt_load_lib((lib_name == NULL) ? ittnotify_lib_name : lib_name);
930 
931  if (_N_(_ittapi_global).lib != NULL)
932  {
933  __itt_api_init_t* __itt_api_init_ptr;
934  int lib_version = __itt_lib_version(_N_(_ittapi_global).lib);
935 
936  switch (lib_version) {
937  case 0:
938  groups = __itt_group_legacy;
939  /* Falls through */
940  case 1:
941  /* Fill all pointers from dynamic library */
942  for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++)
943  {
944  if (_N_(_ittapi_global).api_list_ptr[i].group & groups & init_groups)
945  {
946  *_N_(_ittapi_global).api_list_ptr[i].func_ptr = (void*)__itt_get_proc(_N_(_ittapi_global).lib, _N_(_ittapi_global).api_list_ptr[i].name);
947  if (*_N_(_ittapi_global).api_list_ptr[i].func_ptr == NULL)
948  {
949  /* Restore pointers for function with static implementation */
950  *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func;
951  __itt_report_error(__itt_error_no_symbol, lib_name, _N_(_ittapi_global).api_list_ptr[i].name);
952 #ifdef ITT_COMPLETE_GROUP
953  zero_group = (__itt_group_id)(zero_group | _N_(_ittapi_global).api_list_ptr[i].group);
954 #endif /* ITT_COMPLETE_GROUP */
955  }
956  }
957  else
958  *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func;
959  }
960 
961  if (groups == __itt_group_legacy)
962  {
963  /* Compatibility with legacy tools */
964  ITTNOTIFY_NAME(thread_ignore) = ITTNOTIFY_NAME(thr_ignore);
965 #if ITT_PLATFORM==ITT_PLATFORM_WIN
966  ITTNOTIFY_NAME(sync_createA) = ITTNOTIFY_NAME(sync_set_nameA);
967  ITTNOTIFY_NAME(sync_createW) = ITTNOTIFY_NAME(sync_set_nameW);
968 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
969  ITTNOTIFY_NAME(sync_create) = ITTNOTIFY_NAME(sync_set_name);
970 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
971  ITTNOTIFY_NAME(sync_prepare) = ITTNOTIFY_NAME(notify_sync_prepare);
972  ITTNOTIFY_NAME(sync_cancel) = ITTNOTIFY_NAME(notify_sync_cancel);
973  ITTNOTIFY_NAME(sync_acquired) = ITTNOTIFY_NAME(notify_sync_acquired);
974  ITTNOTIFY_NAME(sync_releasing) = ITTNOTIFY_NAME(notify_sync_releasing);
975  }
976 
977 #ifdef ITT_COMPLETE_GROUP
978  for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++)
979  if (_N_(_ittapi_global).api_list_ptr[i].group & zero_group)
980  *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func;
981 #endif /* ITT_COMPLETE_GROUP */
982  break;
983  case 2:
984  __itt_api_init_ptr = (__itt_api_init_t*)(size_t)__itt_get_proc(_N_(_ittapi_global).lib, "__itt_api_init");
985  if (__itt_api_init_ptr)
986  __itt_api_init_ptr(&_N_(_ittapi_global), init_groups);
987  break;
988  }
989  }
990  else
991  {
993 #if ITT_PLATFORM==ITT_PLATFORM_WIN
994  int error = __itt_system_error();
995 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
996  const char* error = dlerror();
997 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
998  __itt_report_error(__itt_error_no_module, lib_name, error);
999  }
1000  }
1001  else
1002  {
1004  }
1005  _N_(_ittapi_global).api_initialized = 1;
1006  current_thread = 0;
1007  /* !!! Just to avoid unused code elimination !!! */
1008  if (__itt_fini_ittlib_ptr == _N_(fini_ittlib)) current_thread = 0;
1009  }
1010  }
1011 
1012 #ifndef ITT_SIMPLE_INIT
1013  __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
1014 #endif /* ITT_SIMPLE_INIT */
1015  }
1016 
1017  /* Evaluating if any function ptr is non empty and it's in init_groups */
1018  for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++)
1019  {
1020  if (*_N_(_ittapi_global).api_list_ptr[i].func_ptr != _N_(_ittapi_global).api_list_ptr[i].null_func &&
1021  _N_(_ittapi_global).api_list_ptr[i].group & init_groups)
1022  {
1023  return 1;
1024  }
1025  }
1026  return 0;
1027 }
1028 
1029 ITT_EXTERN_C __itt_error_handler_t* _N_(set_error_handler)(__itt_error_handler_t* handler)
1030 {
1031  __itt_error_handler_t* prev = (__itt_error_handler_t*)(size_t)_N_(_ittapi_global).error_handler;
1032  _N_(_ittapi_global).error_handler = (void*)(size_t)handler;
1033  return prev;
1034 }
1035 
1036 #if ITT_PLATFORM==ITT_PLATFORM_WIN
1037 #pragma warning(pop)
1038 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
1039 
#define __itt_thread_id()
#define ITT_MUTEX_INIT_AND_LOCK(p)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event ITT_FORMAT __itt_group_mark d void const wchar_t const wchar_t int ITT_FORMAT __itt_group_sync __itt_group_fsync x void const wchar_t int const wchar_t int int ITT_FORMAT __itt_group_sync __itt_group_fsync x void ITT_FORMAT __itt_group_sync __itt_group_fsync p void ITT_FORMAT __itt_group_sync __itt_group_fsync p void size_t ITT_FORMAT lu no args __itt_obj_prop_t __itt_obj_state_t ITT_FORMAT d const char ITT_FORMAT s __itt_frame ITT_FORMAT p const char const char ITT_FORMAT s __itt_counter ITT_FORMAT p __itt_counter unsigned long long ITT_FORMAT lu const wchar_t ITT_FORMAT __itt_group_mark
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT __itt_group_sync
#define ITT_MAGIC
ITT_EXTERN_C __itt_error_handler_t *_N_() set_error_handler(__itt_error_handler_t *handler)
HMODULE lib_t
ITT_EXTERN_C int _N_() init_ittlib(const char *, __itt_group_id)
static const char * __itt_get_lib_name(void)
static void __itt_report_error_impl(int code,...)
#define _N_(n)
enum ___itt_group_id __itt_group_id
#define MAX_ENV_VALUE_SIZE
void const char const char int ITT_FORMAT __itt_group_sync s
#define MUTEX_INITIALIZER
static __itt_group_alias group_alias[]
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event ITT_FORMAT __itt_group_mark d void const wchar_t const wchar_t int ITT_FORMAT __itt_group_sync __itt_group_fsync x void const wchar_t int const wchar_t int int ITT_FORMAT __itt_group_sync __itt_group_fsync x notify_sync_cancel
#define LIB_VAR_NAME
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p sync_cancel
#define __itt_system_error()
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p __itt_group_suppress
#define __itt_fstrcmp(s1, s2)
Public User API functions and types.
ITT_EXTERN_C void _N_() fini_ittlib(void)
sync_createA
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int namelen
void() __itt_fini_ittlib_t(void)
#define NEW_DOMAIN_W(gptr, h, h_tail, name)
static const char * ittnotify_lib_name
#define NEW_DOMAIN_A(gptr, h, h_tail, name)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark __itt_group_legacy
#define API_VERSION
#define __itt_report_error(code,...)
#define PATH_MAX
#define API_VERSION_BUILD
#define __itt_load_lib(name)
static __itt_group_id __itt_get_groups(void)
#define __itt_fstrcpyn(s1, b, s2, l)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p sync_releasing
#define __itt_init_ittlib_name
__itt_group_id groups
#define ITT_EXTERN_C
void() __itt_api_fini_t(__itt_global *)
#define ITT_GROUP_LIST(varname)
void() __itt_api_init_t(__itt_global *, __itt_group_id)
static __itt_domain *ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createW), _init)) const
static void __itt_nullify_all_pointers(void)
void const char const char int ITT_FORMAT __itt_group_sync __itt_group_fsync
Legacy User API functions and types.
#define ITT_TO_STR(x)
static const char * __itt_fsplit(const char *s, const char *sep, const char **out, int *len)
#define __itt_get_proc(lib, name)
#define __itt_mutex_lock(mutex)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event ITT_FORMAT __itt_group_mark d sync_set_nameW
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
DWORD TIDT
#define __itt_min(a, b)
struct ___itt_group_alias __itt_group_alias
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event ITT_FORMAT __itt_group_mark d void const wchar_t const wchar_t int ITT_FORMAT __itt_group_sync __itt_group_fsync x void const wchar_t int const wchar_t int int ITT_FORMAT __itt_group_sync __itt_group_fsync x void ITT_FORMAT __itt_group_sync __itt_group_fsync p notify_sync_releasing
int() __itt_init_ittlib_t(const char *, __itt_group_id)
static __itt_api_info api_list[]
#define NEW_STRING_HANDLE_A(gptr, h, h_tail, name)
static int __itt_lib_version(lib_t lib)
static const char dll_path[PATH_MAX]
static const char api_version[]
#define __itt_mutex_unlock(mutex)
#define __itt_fstrnlen(s, l)
static __itt_fini_ittlib_t * __itt_fini_ittlib_ptr
#define NEW_STRING_HANDLE_W(gptr, h, h_tail, name)
static const char * __itt_get_env_var(const char *name)
static __itt_init_ittlib_t * __itt_init_ittlib_ptr
namespace msvc_inline_asm static inline void pause(uintptr_t delay)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function h

Copyright © 2005-2019 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.