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_list< Types > Class Template Reference

This is a variadic component wrapper where all components are optional at runtime. Accept unlimited number of parameters. The default behavior is to query the TIMEMORY_COMPONENT_LIST_INIT environment variable once (the first time the bundle is used) and use that list of components (if any) to initialize the components which are part of it's template parameters. This behavior can be modified by assigning a new lambda/functor to the reference which is returned from tim::component_list<Types...>::get_initializer(). Assignment is not thread-safe since this is relatively unnecessary... if a different set of components are required on a particular thread, just create a different type with those particular components or pass the initialization functor to the constructor. More...

#include "timemory/variadic/component_list.hpp"

+ Collaboration diagram for tim::component_list< Types >:

Public Types

using captured_location_t = source_location::captured
 
using bundle_type = bundle< TIMEMORY_API, component_list<>, tim::variadic::heap_wrapper_types< concat< Types... > > >
 
using this_type = component_list< Types... >
 
using component_type = component_list< Types... >
 
using auto_type = auto_list< Types... >
 

Public Member Functions

template<typename... Args>
 component_list (Args &&...)
 
 ~component_list ()=default
 
 component_list (const component_list &)=default
 
 component_list (component_list &&)=default
 
component_listoperator= (const component_list &rhs)=default
 
component_listoperator= (component_list &&)=default
 
template<typename... Args>
 component_list (Args &&... args)
 

Detailed Description

template<typename... Types>
class tim::component_list< Types >

This is a variadic component wrapper where all components are optional at runtime. Accept unlimited number of parameters. The default behavior is to query the TIMEMORY_COMPONENT_LIST_INIT environment variable once (the first time the bundle is used) and use that list of components (if any) to initialize the components which are part of it's template parameters. This behavior can be modified by assigning a new lambda/functor to the reference which is returned from tim::component_list<Types...>::get_initializer(). Assignment is not thread-safe since this is relatively unnecessary... if a different set of components are required on a particular thread, just create a different type with those particular components or pass the initialization functor to the constructor.

Template Parameters
TypesSpecification of the component types to bundle together
void foo()
{
setenv("TIMEMORY_COMPONENT_LIST_INIT", "wall_clock", 0);
auto bar = bundle_t("bar");
bundle_t::get_initializer() = [](bundle_t& b)
{
b.initialize<cpu_clock, peak_rss>();
};
auto qix = bundle_t("qix");
auto local_init = [](bundle_t& b)
{
b.initialize<thread_cpu_clock, peak_rss>();
};
auto spam = bundle_t("spam", ..., local_init);
}
This is a variadic component wrapper where all components are optional at runtime....

The above code will record wall-clock timer on first use of "bar", and will record cpu-clock, peak-rss at "qix", and peak-rss at "spam". If foo() is called a second time, "bar" will record cpu-clock and peak-rss. "spam" will always use the local initialized. If none of these initializers are set, wall-clock will be recorded for all of them. The intermediate storage will happen on the heap and when the destructor is called, it will add itself to the call-graph

Definition at line 94 of file component_list.hpp.

Member Typedef Documentation

◆ auto_type

template<typename... Types>
using tim::component_list< Types >::auto_type = auto_list<Types...>

Definition at line 106 of file component_list.hpp.

◆ bundle_type

template<typename... Types>
using tim::component_list< Types >::bundle_type = bundle<TIMEMORY_API, component_list<>, tim::variadic::heap_wrapper_types<concat<Types...> >>

Definition at line 102 of file component_list.hpp.

◆ captured_location_t

template<typename... Types>
using tim::component_list< Types >::captured_location_t = source_location::captured

Definition at line 100 of file component_list.hpp.

◆ component_type

template<typename... Types>
using tim::component_list< Types >::component_type = component_list<Types...>

Definition at line 105 of file component_list.hpp.

◆ this_type

template<typename... Types>
using tim::component_list< Types >::this_type = component_list<Types...>

Definition at line 104 of file component_list.hpp.

Constructor & Destructor Documentation

◆ component_list() [1/4]

template<typename... Types>
template<typename... Args>
tim::component_list< Types >::component_list ( Args &&  ...)

◆ ~component_list()

template<typename... Types>
tim::component_list< Types >::~component_list ( )
default

◆ component_list() [2/4]

template<typename... Types>
tim::component_list< Types >::component_list ( const component_list< Types > &  )
default

◆ component_list() [3/4]

template<typename... Types>
tim::component_list< Types >::component_list ( component_list< Types > &&  )
default

◆ component_list() [4/4]

template<typename... Types>
template<typename... Args>
tim::component_list< Types >::component_list ( Args &&...  args)

Definition at line 122 of file component_list.hpp.

123: bundle_type{ std::forward<Args>(args)... }
124{}
bundle< TIMEMORY_API, component_list<>, tim::variadic::heap_wrapper_types< concat< Types... > > > bundle_type

Member Function Documentation

◆ operator=() [1/2]

template<typename... Types>
component_list & tim::component_list< Types >::operator= ( component_list< Types > &&  )
default

◆ operator=() [2/2]

template<typename... Types>
component_list & tim::component_list< Types >::operator= ( const component_list< Types > &  rhs)
default

The documentation for this class was generated from the following file: