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

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.