component_bundle¶
The component_bundle variadic bundler is the recommended variadic bundler for
custom interface implementations with timemory when storage is desired. Custom interfaces should create
a unique API struct for their implementation, e.g. via the convenience macro, TIMEMORY_DECLARE_API(myproject)
and TIMEMORY_DEFINE_API(myproject) will declare/define tim::api::myproject and will ensure
tim::concepts::is_api is satisfied for your API. Once this is done, bundles of tools can be aliased as such:
template <typename... Types>
using timemory_bundle_t = tim::component_bundle<tim::api::myproject, Types...>;
template <typename... Types>
using timemory_auto_bundle_t = tim::auto_bundle<tim::api::myproject, Types...>;
Using this scheme, you can disable all timemory instrumentation at compile-time or run-time via:
// disable at compile-time
TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, api::myproject, false_type)
// disable at run-time
void disable_timemory_in_myproject()
{
tim::trait::runtime_enabled<tim::api::myproject>::set(false);
}
-
template<typename ...
Types>
classcomponent_bundle¶ This is a variadic component wrapper which combines the features of tim::component_tuple<T…> and tim::component_list<U..>. The “T” types (compile-time fixed, allocated on stack) should be specified as usual, the “U” types (runtime-time optional, allocated on the heap) should be specified as a pointer. Initialization of the optional types is similar to tim::auto_list<U…> but no environment variable is built-in since, ideally, this environment variable should be customized based on the Tag template parameter.
See also: tim::auto_bundle. The primary difference b/t the “component_*” and “auto_*” is that the latter used the constructor/destructor to call start and stop and is thus easier to just copy-and-paste into different places. However, the former is better suited for special configuration, data-access, etc.
- tparam Tag
unique identifying type for the bundle which when tim::trait::is_available<Tag> is false at compile-time or tim::trait::runtime_enabled<Tag>() is false at runtime, then none of the components will be collected
- tparam Types
Specification of the component types to bundle together
-
template<typename
Tag, typename ...Types>
classtim::component_bundle<Tag, Types...> : public tim::bundle<Tag, component_bundle<Tag>, tim::variadic::mixed_wrapper_types<concat<Types...>>>, public tim::concepts::mixed_wrapper¶ Public Types
-
using
captured_location_t= source_location::captured¶
-
using
bundle_type= bundle<Tag, component_bundle<Tag>, tim::variadic::mixed_wrapper_types<concat<Types...>>>¶
-
using
this_type= component_bundle<Tag, Types...>¶
-
using
component_type= component_bundle<Tag, Types...>¶
-
using
auto_type= auto_bundle<Tag, Types...>¶
Public Functions
-
~component_bundle() = default¶
-
component_bundle(const component_bundle&) = default¶
-
component_bundle(component_bundle&&) = default¶
-
component_bundle &
operator=(const component_bundle &rhs) = default¶
-
component_bundle &
operator=(component_bundle&&) = default¶
-
template<typename ...
Args>component_bundle(Args&&... args)
-
using