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.
|
This component is provided to facilitate data tracking. The first template parameter is the type of data to be tracked, the second is a custom tag for differentiating trackers which handle the same data types but record different high-level data. More...
#include "timemory/components/data_tracker/components.hpp"
Classes | |
class | vector_map |
Public Types | |
using | value_type = InpT |
using | this_type = data_tracker< InpT, Tag > |
using | base_type = base< this_type, value_type > |
using | handler_type = data::handler< InpT, Tag > |
using | storage_type = empty_storage |
Public Member Functions | |
void | start () |
void | stop () |
auto | get () const |
get the data in the final form after unit conversion More... | |
auto | get_display () const |
get the data in a form suitable for display More... | |
auto | get_secondary () const |
map of the secondary entries. When TIMEMORY_ADD_SECONDARY is enabled contents of this map will be added as direct children of the current node in the call-graph. More... | |
template<typename T > | |
void | store (T &&val, enable_if_acceptable_t< T, int >=0) |
store some data. Uses tim::data::handler for the type. More... | |
template<typename T > | |
void | store (handler_type &&, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which takes a handler to ensure proper overload resolution More... | |
template<typename FuncT , typename T > | |
auto | store (FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) -> decltype(std::declval< handler_type >().store(*this, std::forward< FuncT >(f), std::forward< T >(val)), void()) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values More... | |
template<typename FuncT , typename T > | |
auto | store (handler_type &&, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) -> decltype(std::declval< handler_type >().store(*this, std::forward< FuncT >(f), std::forward< T >(val)), void()) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution More... | |
template<typename T > | |
void | mark_begin (T &&val, enable_if_acceptable_t< T, int >=0) |
The combination of mark_begin(...) and mark_end(...) can be used to store some initial data which may be needed later. When mark_end(...) is called, the value is updated with the difference of the value provided to mark_end and the temporary stored during mark_begin . More... | |
template<typename T > | |
void | mark_begin (handler_type &&, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which takes a handler to ensure proper overload resolution More... | |
template<typename FuncT , typename T > | |
void | mark_begin (FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values More... | |
template<typename FuncT , typename T > | |
void | mark_begin (handler_type &&, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution More... | |
template<typename T > | |
void | mark_end (T &&val, enable_if_acceptable_t< T, int >=0) |
The combination of mark_begin(...) and mark_end(...) can be used to store some initial data which may be needed later. When mark_end(...) is called, the value is updated with the difference of the value provided to mark_end and the temporary stored during mark_begin . It may be valid to call mark_end without calling mark_begin but the result will effectively be a more expensive version of calling store . More... | |
template<typename T > | |
void | mark_end (handler_type &&, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which takes a handler to ensure proper overload resolution More... | |
template<typename FuncT , typename T > | |
void | mark_end (FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values More... | |
template<typename FuncT , typename T > | |
void | mark_end (handler_type &&, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution More... | |
template<typename T > | |
this_type * | add_secondary (const std::string &_key, T &&val, enable_if_acceptable_t< T, int >=0) |
add a secondary value to the current node in the call-graph. When TIMEMORY_ADD_SECONDARY is enabled contents of this map will be added as direct children of the current node in the call-graph. This is useful for finer-grained details that might not always be desirable to display More... | |
template<typename T > | |
this_type * | add_secondary (const std::string &_key, handler_type &&h, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which takes a handler to ensure proper overload resolution More... | |
template<typename FuncT , typename T > | |
this_type * | add_secondary (const std::string &_key, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values More... | |
template<typename FuncT , typename T > | |
this_type * | add_secondary (const std::string &_key, handler_type &&h, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >=0) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution More... | |
void | set_value (const value_type &v) |
set the current value More... | |
void | set_value (value_type &&v) |
set the current value via move More... | |
void | set_last (value_type &&_v) |
void | set_last (value_type &_v) |
value_type | get_last () const |
template<typename T > | |
data_tracker< InpT, Tag > * | add_secondary (const std::string &_key, T &&val, enable_if_acceptable_t< T, int >) |
template<typename T > | |
data_tracker< InpT, Tag > * | add_secondary (const std::string &_key, handler_type &&h, T &&val, enable_if_acceptable_t< T, int >) |
template<typename FuncT , typename T > | |
data_tracker< InpT, Tag > * | add_secondary (const std::string &_key, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >) |
template<typename FuncT , typename T > | |
data_tracker< InpT, Tag > * | add_secondary (const std::string &_key, handler_type &&h, FuncT &&f, T &&val, enable_if_acceptable_t< T, int >) |
Static Public Member Functions | |
static std::string & | label () |
a reference is returned here so that it can be easily updated More... | |
static std::string & | description () |
a reference is returned here so that it can be easily updated More... | |
static auto & | get_unit () |
this returns a reference so that it can be easily modified More... | |
template<typename... Args> | |
static opaque | get_opaque (Args &&...) |
Friends | |
struct | operation::record< this_type > |
struct | operation::start< this_type > |
struct | operation::stop< this_type > |
struct | operation::set_started< this_type > |
struct | operation::set_stopped< this_type > |
This component is provided to facilitate data tracking. The first template parameter is the type of data to be tracked, the second is a custom tag for differentiating trackers which handle the same data types but record different high-level data.
Usage:
When creating new data trackers, it is recommended to have this in header:
And this in one source file (preferably one that is not re-compiled often)
where custom_data_tracker_t
is the custom data tracker type (or an alias to the type) and data_type
is the data type being tracked.
Definition at line 147 of file components.hpp.
using tim::component::data_tracker< InpT, Tag >::base_type = base<this_type, value_type> |
Definition at line 151 of file components.hpp.
using tim::component::data_tracker< InpT, Tag >::handler_type = data::handler<InpT, Tag> |
Definition at line 152 of file components.hpp.
|
inherited |
Definition at line 66 of file declaration.hpp.
using tim::component::data_tracker< InpT, Tag >::this_type = data_tracker<InpT, Tag> |
Definition at line 150 of file components.hpp.
using tim::component::data_tracker< InpT, Tag >::value_type = InpT |
Definition at line 149 of file components.hpp.
data_tracker< InpT, Tag > * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | |||
) |
Definition at line 671 of file components.hpp.
this_type * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values
data_tracker< InpT, Tag > * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
handler_type && | h, | ||
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | |||
) |
Definition at line 690 of file components.hpp.
this_type * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
handler_type && | h, | ||
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution
data_tracker< InpT, Tag > * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
handler_type && | h, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | |||
) |
Definition at line 652 of file components.hpp.
this_type * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
handler_type && | h, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which takes a handler to ensure proper overload resolution
data_tracker< InpT, Tag > * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
T && | val, | ||
enable_if_acceptable_t< T, int > | |||
) |
Definition at line 635 of file components.hpp.
this_type * tim::component::data_tracker< InpT, Tag >::add_secondary | ( | const std::string & | _key, |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
add a secondary value to the current node in the call-graph. When TIMEMORY_ADD_SECONDARY is enabled contents of this map will be added as direct children of the current node in the call-graph. This is useful for finer-grained details that might not always be desirable to display
|
static |
a reference is returned here so that it can be easily updated
Definition at line 478 of file components.hpp.
References tim::debug, tim::component::metadata< Tp >::description(), tim::component::metadata< Tp >::extra_description(), and tim::verbose.
Referenced by tim::invoke_preinit< kokkosp::memory_tracker >().
|
inline |
get the data in the final form after unit conversion
Definition at line 252 of file components.hpp.
References tim::data::handler< V, Tag >::get().
|
inline |
get the data in a form suitable for display
Definition at line 255 of file components.hpp.
References tim::data::handler< V, Tag >::get_display().
|
inline |
Definition at line 409 of file components.hpp.
|
inlinestaticinherited |
Definition at line 72 of file declaration.hpp.
|
inline |
map of the secondary entries. When TIMEMORY_ADD_SECONDARY is enabled contents of this map will be added as direct children of the current node in the call-graph.
Definition at line 260 of file components.hpp.
|
inlinestatic |
this returns a reference so that it can be easily modified
Definition at line 239 of file components.hpp.
References tim::component::base< Tp, Value >::get_unit().
|
inlinestatic |
a reference is returned here so that it can be easily updated
Definition at line 466 of file components.hpp.
References TIMEMORY_JOIN.
Referenced by tim::invoke_preinit< kokkosp::memory_tracker >().
void tim::component::data_tracker< InpT, Tag >::mark_begin | ( | FuncT && | f, |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values
Definition at line 593 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_begin | ( | handler_type && | , |
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution
Definition at line 613 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_begin | ( | handler_type && | , |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which takes a handler to ensure proper overload resolution
Definition at line 573 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_begin | ( | T && | val, |
enable_if_acceptable_t< T, int > | = 0 |
||
) |
The combination of mark_begin(...)
and mark_end(...)
can be used to store some initial data which may be needed later. When mark_end(...)
is called, the value is updated with the difference of the value provided to mark_end
and the temporary stored during mark_begin
.
Definition at line 554 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_end | ( | FuncT && | f, |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values
Definition at line 602 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_end | ( | handler_type && | , |
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution
Definition at line 623 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_end | ( | handler_type && | , |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which takes a handler to ensure proper overload resolution
Definition at line 583 of file components.hpp.
References tim::math::divide().
void tim::component::data_tracker< InpT, Tag >::mark_end | ( | T && | val, |
enable_if_acceptable_t< T, int > | = 0 |
||
) |
The combination of mark_begin(...)
and mark_end(...)
can be used to store some initial data which may be needed later. When mark_end(...)
is called, the value is updated with the difference of the value provided to mark_end
and the temporary stored during mark_begin
. It may be valid to call mark_end
without calling mark_begin
but the result will effectively be a more expensive version of calling store
.
Definition at line 563 of file components.hpp.
References tim::math::divide().
|
inline |
Definition at line 407 of file components.hpp.
|
inline |
Definition at line 408 of file components.hpp.
|
inline |
|
inline |
set the current value via move
Definition at line 403 of file components.hpp.
|
inline |
Definition at line 248 of file components.hpp.
|
inline |
Definition at line 249 of file components.hpp.
auto tim::component::data_tracker< InpT, Tag >::store | ( | FuncT && | f, |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) | -> decltype(std::declval<handler_type>().store(*this, std::forward<FuncT>(f), std::forward<T>(val)), void()) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values
Definition at line 525 of file components.hpp.
References tim::math::divide(), and tim::invoke::store().
auto tim::component::data_tracker< InpT, Tag >::store | ( | handler_type && | , |
FuncT && | f, | ||
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) | -> decltype(std::declval<handler_type>().store(*this, std::forward<FuncT>(f), std::forward<T>(val)), void()) |
overload which uses a lambda to bypass the default behavior of how the handler updates the values and takes a handler to ensure proper overload resolution
Definition at line 539 of file components.hpp.
References tim::math::divide(), and tim::invoke::store().
void tim::component::data_tracker< InpT, Tag >::store | ( | handler_type && | , |
T && | val, | ||
enable_if_acceptable_t< T, int > | = 0 |
||
) |
overload which takes a handler to ensure proper overload resolution
Definition at line 514 of file components.hpp.
References tim::math::divide(), and tim::invoke::store().
void tim::component::data_tracker< InpT, Tag >::store | ( | T && | val, |
enable_if_acceptable_t< T, int > | = 0 |
||
) |
store some data. Uses tim::data::handler for the type.
Definition at line 503 of file components.hpp.
References tim::math::divide(), and tim::invoke::store().
|
friend |
Definition at line 690 of file components.hpp.
|
friend |
Definition at line 690 of file components.hpp.
|
friend |
Definition at line 690 of file components.hpp.
|
friend |
Definition at line 690 of file components.hpp.
|
friend |
Definition at line 690 of file components.hpp.