Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
itt_notify.h
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 #ifndef _TBB_ITT_NOTIFY
22 #define _TBB_ITT_NOTIFY
23 
24 #include "tbb/tbb_stddef.h"
25 
26 #if DO_ITT_NOTIFY
27 
28 #if _WIN32||_WIN64
29  #ifndef UNICODE
30  #define UNICODE
31  #endif
32 #endif /* WIN */
33 
34 #ifndef INTEL_ITTNOTIFY_API_PRIVATE
35 #define INTEL_ITTNOTIFY_API_PRIVATE
36 #endif
37 
38 #include "tools_api/ittnotify.h"
40 extern "C" void __itt_fini_ittlib(void);
41 
42 #if _WIN32||_WIN64
43  #undef _T
44  #undef __itt_event_create
45  #define __itt_event_create __itt_event_createA
46 #endif /* WIN */
47 
48 
49 #endif /* DO_ITT_NOTIFY */
50 
51 #if !ITT_CALLER_NULL
52 #define ITT_CALLER_NULL ((__itt_caller)0)
53 #endif
54 
55 namespace tbb {
57 #if (_WIN32||_WIN64) && !__MINGW32__
58 
60  typedef wchar_t tchar;
62  #define _T(string_literal) L ## string_literal
63 #else /* !WIN */
64  typedef char tchar;
66  #define _T(string_literal) string_literal
67 #endif /* !WIN */
68 } // namespace tbb
69 
70 #if DO_ITT_NOTIFY
71 namespace tbb {
73  extern const tchar
74  *SyncType_GlobalLock,
75  *SyncType_Scheduler;
77  extern const tchar
78  *SyncObj_SchedulerInitialization,
79  *SyncObj_SchedulersList,
80  *SyncObj_WorkerLifeCycleMgmt,
81  *SyncObj_TaskStealingLoop,
82  *SyncObj_WorkerTaskPool,
83  *SyncObj_MasterTaskPool,
84  *SyncObj_TaskPoolSpinning,
85  *SyncObj_Mailbox,
86  *SyncObj_TaskReturnList,
87  *SyncObj_TaskStream,
88 #if __TBB_PREVIEW_CRITICAL_TASKS
89  *SyncObj_CriticalTaskStream,
90 #endif
91  *SyncObj_ContextsList
92  ;
93 
94  namespace internal {
95  void __TBB_EXPORTED_FUNC itt_set_sync_name_v3( void* obj, const tchar* name);
96 
97  } // namespace internal
98 
99 } // namespace tbb
100 
101 // const_cast<void*>() is necessary to cast off volatility
102 #define ITT_NOTIFY(name,obj) __itt_notify_##name(const_cast<void*>(static_cast<volatile void*>(obj)))
103 #define ITT_THREAD_SET_NAME(name) __itt_thread_set_name(name)
104 #define ITT_FINI_ITTLIB() __itt_fini_ittlib()
105 #define ITT_SYNC_CREATE(obj, type, name) __itt_sync_create((void*)(obj), type, name, 2)
106 #define ITT_SYNC_RENAME(obj, name) __itt_sync_rename(obj, name)
107 #define ITT_STACK_CREATE(obj) obj = __itt_stack_caller_create()
108 #if __TBB_TASK_GROUP_CONTEXT
109 #define ITT_STACK(precond, name, obj) (precond) ? __itt_stack_##name(obj) : ((void)0);
110 #else
111 #define ITT_STACK(precond, name, obj) ((void)0)
112 #endif /* !__TBB_TASK_GROUP_CONTEXT */
113 
114 #define ITT_TASK_GROUP(obj,name,parent) itt_make_task_group_v7(internal::ITT_DOMAIN_MAIN,(void*)(obj),ALGORITHM,(void*)(parent),(parent!=NULL) ? ALGORITHM : FLOW_NULL,name)
115 #define ITT_TASK_BEGIN(obj,name,id) itt_task_begin_v7(internal::ITT_DOMAIN_MAIN,(void*)(id),ALGORITHM,(void*)(obj),ALGORITHM,name)
116 #define ITT_TASK_END itt_task_end_v7(internal::ITT_DOMAIN_MAIN)
117 
118 #else /* !DO_ITT_NOTIFY */
119 
120 #define ITT_NOTIFY(name,obj) ((void)0)
121 #define ITT_THREAD_SET_NAME(name) ((void)0)
122 #define ITT_FINI_ITTLIB() ((void)0)
123 #define ITT_SYNC_CREATE(obj, type, name) ((void)0)
124 #define ITT_SYNC_RENAME(obj, name) ((void)0)
125 #define ITT_STACK_CREATE(obj) ((void)0)
126 #define ITT_STACK(precond, name, obj) ((void)0)
127 
128 #define ITT_TASK_GROUP(type,name,parent) ((void)0)
129 #define ITT_TASK_BEGIN(type,name,id) ((void)0)
130 #define ITT_TASK_END ((void)0)
131 
132 #endif /* !DO_ITT_NOTIFY */
133 
134 namespace tbb {
135 namespace internal {
137 }}
138 
139 #endif /* _TBB_ITT_NOTIFY */
int __TBB_load_ittnotify()
Legacy User API functions and types.
The graph class.
#define __TBB_EXPORTED_FUNC
char tchar
Unicode support.
Definition: itt_notify.h:64
void itt_set_sync_name_v3(void *obj, const tchar *name)
Definition: tbb_main.cpp:427
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name
Public User API functions and types.

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.