timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::component::factory::hidden Namespace Reference

Classes

struct  opaque_typeids
 
struct  opaque_typeids< T, false >
 
struct  opaque_typeids< TupleT< T... >, false >
 
struct  opaque_typeids< TupleT< T... >, true >
 

Functions

template<typename Toolset >
enable_if_t<!concepts::is_wrapper< Toolset >::value &&trait::is_available< Toolset >::value, opaqueget_opaque (scope::config _scope)
 
template<typename Toolset , typename... Args>
enable_if_t< concepts::is_wrapper< Toolset >::value, opaqueget_opaque (scope::config _scope, Args... args)
 
template<typename Toolset , typename... Args>
enable_if_t<!trait::is_available< Toolset >::value, opaqueget_opaque (scope::config, Args &&...)
 

Class Documentation

◆ tim::component::factory::hidden::opaque_typeids

struct tim::component::factory::hidden::opaque_typeids
template<typename T, bool IsWrapper = concepts::is_wrapper<T>::value>
struct tim::component::factory::hidden::opaque_typeids< T, IsWrapper >

Definition at line 222 of file definition.hpp.

+ Collaboration diagram for tim::component::factory::hidden::opaque_typeids< T, IsWrapper >:

Function Documentation

◆ get_opaque() [1/3]

template<typename Toolset >
enable_if_t<!concepts::is_wrapper< Toolset >::value &&trait::is_available< Toolset >::value, opaque > tim::component::factory::hidden::get_opaque ( scope::config  _scope)

Definition at line 88 of file definition.hpp.

89{
90 opaque _obj = Toolset::get_opaque(_scope);
91
92 // this is not in base-class impl
94
95 return _obj;
96}
opaque get_opaque(scope::config _scope)
Definition: definition.hpp:350
init_func_t m_init
Definition: types.hpp:90

References tim::component::factory::get_opaque(), and tim::component::opaque::m_init.

◆ get_opaque() [2/3]

template<typename Toolset , typename... Args>
enable_if_t< concepts::is_wrapper< Toolset >::value, opaque > tim::component::factory::hidden::get_opaque ( scope::config  _scope,
Args...  args 
)

Definition at line 104 of file definition.hpp.

105{
106 using Toolset_t = Toolset;
107
108 if(Toolset::size() == 0)
109 {
110 DEBUG_PRINT_HERE("returning! %s is empty", demangle<Toolset>().c_str());
111 return opaque{};
112 }
113
114 opaque _obj{};
115
116 _obj.m_valid = true;
117
118 _obj.m_typeid = typeid_hash<Toolset>();
119
120 _obj.m_init = []() {};
121
122 auto _setup = [=](void* v_result, string_view_cref_t _prefix,
123 scope::config _arg_scope) {
124 DEBUG_PRINT_HERE("Setting up %s", demangle<Toolset>().c_str());
125 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
126 if(_result == nullptr)
127 {
128 _result =
129 create_heap_variadic<Toolset_t>(_prefix, _scope + _arg_scope, args...);
130 }
131 else
132 {
133 _result->rekey(_prefix);
134 }
135 return static_cast<void*>(_result);
136 };
137
138 _obj.m_setup = _setup;
139
140 _obj.m_push = [_setup](void*& v_result, string_view_cref_t _prefix,
141 scope::config arg_scope) {
142 v_result = _setup(v_result, _prefix, arg_scope);
143 if(v_result)
144 {
145 DEBUG_PRINT_HERE("Pushing %s", demangle<Toolset>().c_str());
146 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
147 _result->push();
148 }
149 };
150
151 _obj.m_sample = [](void* v_result) {
152 if(v_result)
153 {
154 DEBUG_PRINT_HERE("Sampling %s", demangle<Toolset_t>().c_str());
155 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
156 _result->sample();
157 }
158 };
159
160 _obj.m_start = [](void* v_result) {
161 if(v_result)
162 {
163 DEBUG_PRINT_HERE("Starting %s", demangle<Toolset>().c_str());
164 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
165 _result->start();
166 }
167 };
168
169 _obj.m_stop = [](void* v_result) {
170 if(v_result)
171 {
172 DEBUG_PRINT_HERE("Stopping %s", demangle<Toolset>().c_str());
173 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
174 _result->stop();
175 }
176 };
177
178 _obj.m_pop = [](void* v_result) {
179 if(v_result)
180 {
181 DEBUG_PRINT_HERE("Popping %s", demangle<Toolset>().c_str());
182 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
183 _result->pop();
184 }
185 };
186
187 _obj.m_get = [](void* v_result, void*& ptr, size_t _hash) {
188 if(v_result && !ptr)
189 {
190 DEBUG_PRINT_HERE("Getting %s", demangle<Toolset>().c_str());
191 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
192 _result->get(ptr, _hash);
193 }
194 };
195
196 _obj.m_del = [](void* v_result) {
197 if(v_result)
198 {
199 DEBUG_PRINT_HERE("Deleting %s", demangle<Toolset>().c_str());
200 Toolset_t* _result = static_cast<Toolset_t*>(v_result);
201 delete _result;
202 }
203 };
204
205 return _obj;
206}
Toolset
Definition: types.hpp:40
const string_t & _prefix
Definition: definition.hpp:52
const std::string & string_view_cref_t
Definition: language.hpp:103
#define DEBUG_PRINT_HERE(...)
Definition: macros.hpp:168

References tim::_prefix, DEBUG_PRINT_HERE, tim::component::opaque::m_valid, and Toolset.

◆ get_opaque() [3/3]

template<typename Toolset , typename... Args>
enable_if_t<!trait::is_available< Toolset >::value, opaque > tim::component::factory::hidden::get_opaque ( scope::config  ,
Args &&  ... 
)

Definition at line 214 of file definition.hpp.

215{
216 return opaque{};
217}