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

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.