timemory  3.2.1
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::data_tracker< InpT, Tag > Struct Template Reference

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"

+ Collaboration diagram for tim::component::data_tracker< InpT, Tag >:

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 >
 

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_typeadd_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_typeadd_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_typeadd_secondary (const std::string &_key, FuncT &&f, T &&val, enable_if_acceptable_and_func_t< FuncT, 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_typeadd_secondary (const std::string &_key, handler_type &&h, FuncT &&f, T &&val, enable_if_acceptable_and_func_t< FuncT, 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...
 
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_and_func_t< FuncT, 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_and_func_t< FuncT, 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...
 

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 >
 

Detailed Description

template<typename InpT, typename Tag>
struct tim::component::data_tracker< InpT, Tag >

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:

// declarations
struct myproject {};
using itr_tracker_type = data_tracker<uint64_t, myproject>;
using err_tracker_type = data_tracker<double, myproject>;
// add statistics capabilities
TIMEMORY_STATISTICS_TYPE(itr_tracker_type, int64_t)
TIMEMORY_STATISTICS_TYPE(err_tracker_type, double)
// set the label and descriptions
itr_tracker_type, "myproject_iterations", "short desc", "long description")
err_tracker_type, "myproject_convergence", "short desc", "long description")
// this is the generic bundle pairing a timer with an iteration tracker
// using this and not updating the iteration tracker will create entries
// in the call-graph with zero iterations.
using bundle_t = tim::auto_tuple<wall_clock, itr_tracker_type>;
// this is a dedicated bundle for adding data-tracker entries. This style
// can also be used with the iteration tracker or you can bundle
// both trackers together. The auto_tuple will call start on construction
// and stop on destruction so once can construct a nameless temporary of the
// this bundle type and call store(...) on the nameless tmp. This will
// ensure that the statistics are updated for each entry
//
using err_bundle_t = tim::auto_tuple<err_tracker_type>;
// usage in a function is implied below
double err = std::numeric_limits<double>::max();
const double tolerance = 1.0e-6;
bundle_t t("iteration_time");
while(err > tolerance)
{
// store the starting error
double initial_err = err;
// add 1 for each iteration. Stats only updated when t is destroyed or t.stop() is
// called t.store(std::plus<uint64_t>{}, 1);
// ... do something ...
// construct a nameless temporary which records the change in the error and
// update the statistics <-- "foo" will have mean/min/max/stddev of the
// error
err_bundle_t{ "foo" }.store(err - initial_err);
// NOTE: std::plus is used with t above bc it has multiple components so std::plus
// helps ensure 1 doesn't get added to some other component with `store(int)`
// In above err_bundle_t, there is only one component so there is not concern.
}
#define TIMEMORY_METADATA_SPECIALIZATION(TYPE, LABEL, BASIC_DESC,...)
Specialization of the property specialization.
Definition: macros.hpp:288
#define TIMEMORY_STATISTICS_TYPE(COMPONENT, TYPE)
Definition: macros.hpp:184
Definition: kokkosp.cpp:38
while(exe_name.find('\\') !=std::string::npos) exe_name
static std::string & description()
a reference is returned here so that it can be easily updated
Definition: components.hpp:432

When creating new data trackers, it is recommended to have this in header:

TIMEMORY_DECLARE_EXTERN_COMPONENT(custom_data_tracker_t, true, data_type)
#define TIMEMORY_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA,...)
Definition: macros.hpp:720
base_data_t< data_tracker< InpT, Tag >, InpT > data_type
Definition: declaration.hpp:81

And this in one source file (preferably one that is not re-compiled often)

TIMEMORY_INSTANTIATE_EXTERN_COMPONENT(custom_data_tracker_t, true, data_type)
TIMEMORY_INITIALIZE_STORAGE(custom_data_tracker_t)
#define TIMEMORY_INITIALIZE_STORAGE(...)
Definition: macros.hpp:362
#define TIMEMORY_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA,...)
Definition: macros.hpp:731

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.

Member Typedef Documentation

◆ base_type

template<typename InpT , typename Tag >
using tim::component::data_tracker< InpT, Tag >::base_type = base<this_type, value_type>

Definition at line 151 of file components.hpp.

◆ handler_type

template<typename InpT , typename Tag >
using tim::component::data_tracker< InpT, Tag >::handler_type = data::handler<InpT, Tag>

Definition at line 152 of file components.hpp.

◆ this_type

template<typename InpT , typename Tag >
using tim::component::data_tracker< InpT, Tag >::this_type = data_tracker<InpT, Tag>

Definition at line 150 of file components.hpp.

◆ value_type

template<typename InpT , typename Tag >
using tim::component::data_tracker< InpT, Tag >::value_type = InpT

Definition at line 149 of file components.hpp.

Member Function Documentation

◆ add_secondary() [1/8]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
data_tracker<InpT, Tag>* tim::component::data_tracker< InpT, Tag >::add_secondary ( const std::string &  _key,
FuncT &&  f,
T &&  val,
enable_if_acceptable_and_func_t< FuncT, T, int >   
)

Definition at line 617 of file components.hpp.

619 {
620  this_type _tmp;
621  start_t _start(_tmp);
622  _tmp.store(std::forward<FuncT>(f), std::forward<T>(val));
623  stop_t _stop(_tmp);
624  auto& _map = *get_secondary_map();
625  _map.insert({ _key, _tmp });
626  return &(_map[_key]);
627 }
data_tracker< InpT, Tag > this_type
Definition: components.hpp:150

References tim::component::data_tracker< InpT, Tag >::store().

◆ add_secondary() [2/8]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
this_type* tim::component::data_tracker< InpT, Tag >::add_secondary ( const std::string &  _key,
FuncT &&  f,
T &&  val,
enable_if_acceptable_and_func_t< FuncT, T, int >  = 0 
)

overload which uses a lambda to bypass the default behavior of how the handler updates the values

◆ add_secondary() [3/8]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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_and_func_t< FuncT, T, int >   
)

Definition at line 632 of file components.hpp.

635 {
636  this_type _tmp;
637  start_t _start(_tmp);
638  _tmp.store(std::forward<handler_type>(h), std::forward<FuncT>(f),
639  std::forward<T>(val));
640  stop_t _stop(_tmp);
641  auto& _map = *get_secondary_map();
642  _map.insert({ _key, _tmp });
643  return &(_map[_key]);
644 }

References tim::component::data_tracker< InpT, Tag >::store().

◆ add_secondary() [4/8]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
this_type* tim::component::data_tracker< InpT, Tag >::add_secondary ( const std::string &  _key,
handler_type &&  h,
FuncT &&  f,
T &&  val,
enable_if_acceptable_and_func_t< FuncT, 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

◆ add_secondary() [5/8]

template<typename InpT , typename Tag >
template<typename T >
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 602 of file components.hpp.

604 {
605  this_type _tmp;
606  start_t _start(_tmp);
607  _tmp.store(std::forward<handler_type>(h), std::forward<T>(val));
608  stop_t _stop(_tmp);
609  auto& _map = *get_secondary_map();
610  _map.insert({ _key, _tmp });
611  return &(_map[_key]);
612 }

References tim::component::data_tracker< InpT, Tag >::store().

◆ add_secondary() [6/8]

template<typename InpT , typename Tag >
template<typename T >
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

◆ add_secondary() [7/8]

template<typename InpT , typename Tag >
template<typename T >
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 587 of file components.hpp.

589 {
590  this_type _tmp;
591  start_t _start(_tmp);
592  _tmp.store(std::forward<T>(val));
593  stop_t _stop(_tmp);
594  auto& _map = *get_secondary_map();
595  _map.insert({ _key, _tmp });
596  return &(_map[_key]);
597 }

References tim::component::data_tracker< InpT, Tag >::store().

◆ add_secondary() [8/8]

template<typename InpT , typename Tag >
template<typename T >
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

◆ description()

template<typename InpT , typename Tag >
std::string & tim::component::data_tracker< InpT, Tag >::description
static

a reference is returned here so that it can be easily updated

Definition at line 432 of file components.hpp.

433 {
434  static std::string _instance = []() {
436  {
437  auto meta_desc = metadata<this_type>::description();
438  if(settings::verbose() > 0 || settings::debug())
439  {
440  auto meta_extra_desc = metadata<this_type>::extra_description();
441  meta_desc += ". ";
442  meta_desc += meta_extra_desc;
443  }
444  return meta_desc;
445  }
446  std::stringstream ss;
447  ss << "Data tracker for data of type " << demangle<InpT>() << " for "
448  << demangle<Tag>();
449  return ss.str();
450  }();
451  return _instance;
452 }
tim::mpl::apply< std::string > string
Definition: macros.hpp:52
static std::string extra_description()
Definition: metadata.hpp:51
static constexpr bool specialized()
Definition: metadata.hpp:52
static std::string description()
Definition: metadata.hpp:77

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 >().

◆ get()

template<typename InpT , typename Tag >
auto tim::component::data_tracker< InpT, Tag >::get ( ) const
inline

get the data in the final form after unit conversion

Definition at line 208 of file components.hpp.

208 { return handler_type::get(*this); }
static decltype(auto) get(const T &obj)
this function is returns the current value
Definition: handler.hpp:60

References tim::data::handler< V, Tag >::get().

◆ get_display()

template<typename InpT , typename Tag >
auto tim::component::data_tracker< InpT, Tag >::get_display ( ) const
inline

get the data in a form suitable for display

Definition at line 211 of file components.hpp.

212  {
213  return handler_type::get_display(*this);
214  }
static decltype(auto) get_display(const T &obj)
this function is returns the current value in a form suitable for display. It may be necessary to spe...
Definition: handler.hpp:68

References tim::data::handler< V, Tag >::get_display().

◆ get_secondary()

template<typename InpT , typename Tag >
auto tim::component::data_tracker< InpT, Tag >::get_secondary ( ) const
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 219 of file components.hpp.

220  {
221  return (m_secondary) ? *m_secondary : secondary_map_t{};
222  }

◆ get_unit()

template<typename InpT , typename Tag >
static auto& tim::component::data_tracker< InpT, Tag >::get_unit ( )
inlinestatic

this returns a reference so that it can be easily modified

Definition at line 195 of file components.hpp.

196  {
197  static auto _unit = base_type::get_unit();
198  return _unit;
199  }
static int64_t get_unit()

References tim::component::base< Tp, Value >::get_unit().

◆ label()

template<typename InpT , typename Tag >
std::string & tim::component::data_tracker< InpT, Tag >::label
inlinestatic

a reference is returned here so that it can be easily updated

Definition at line 420 of file components.hpp.

421 {
422  static std::string _instance = []() {
425  return TIMEMORY_JOIN("_", typeid(Tag).name(), typeid(InpT).name());
426  }();
427  return _instance;
428 }
static std::string label()
Definition: metadata.hpp:68
#define TIMEMORY_JOIN(delim,...)
Definition: macros.hpp:89

References TIMEMORY_JOIN.

Referenced by tim::invoke_preinit< kokkosp::memory_tracker >().

◆ mark_begin() [1/4]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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 545 of file components.hpp.

546 {
547  handler_type::begin(get_temporary(), std::forward<FuncT>(f),
548  compute_type::divide(std::forward<T>(val), get_unit()));
549 }
static auto & get_unit()
this returns a reference so that it can be easily modified
Definition: components.hpp:195
static void begin(value_type &obj, const value_type &v)
this function sets the value of the temporary in mark_begin.
Definition: handler.hpp:94
static decltype(auto) divide(type &_l, const V &_r)
Definition: math.hpp:1025

References tim::math::divide().

◆ mark_begin() [2/4]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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 565 of file components.hpp.

567 {
568  handler_type::begin(get_temporary(), std::forward<FuncT>(f),
569  compute_type::divide(std::forward<T>(val), get_unit()));
570 }

References tim::math::divide().

◆ mark_begin() [3/4]

template<typename InpT , typename Tag >
template<typename T >
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 525 of file components.hpp.

527 {
528  handler_type::begin(get_temporary(),
529  compute_type::divide(std::forward<T>(val), get_unit()));
530 }

References tim::math::divide().

◆ mark_begin() [4/4]

template<typename InpT , typename Tag >
template<typename T >
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 506 of file components.hpp.

507 {
508  handler_type::begin(get_temporary(),
509  compute_type::divide(std::forward<T>(val), get_unit()));
510 }

References tim::math::divide().

◆ mark_end() [1/4]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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 554 of file components.hpp.

555 {
556  handler_type::end(*this, std::forward<FuncT>(f),
557  compute_type::divide(std::forward<T>(val), get_unit()));
558  if(!get_is_running())
559  ++laps;
560 }
static void end(T &obj, const value_type &v)
this function computes the difference between the provided value and the temporary from mark_begin an...
Definition: handler.hpp:106

References tim::math::divide().

◆ mark_end() [2/4]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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 575 of file components.hpp.

577 {
578  handler_type::end(*this, std::forward<FuncT>(f),
579  compute_type::divide(std::forward<T>(val), get_unit()));
580  if(!get_is_running())
581  ++laps;
582 }

References tim::math::divide().

◆ mark_end() [3/4]

template<typename InpT , typename Tag >
template<typename T >
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 535 of file components.hpp.

536 {
537  handler_type::end(*this, compute_type::divide(std::forward<T>(val), get_unit()));
538  if(!get_is_running())
539  ++laps;
540 }

References tim::math::divide().

◆ mark_end() [4/4]

template<typename InpT , typename Tag >
template<typename T >
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 515 of file components.hpp.

516 {
517  handler_type::end(*this, compute_type::divide(std::forward<T>(val), get_unit()));
518  if(!get_is_running())
519  ++laps;
520 }

References tim::math::divide().

◆ set_value() [1/2]

template<typename InpT , typename Tag >
void tim::component::data_tracker< InpT, Tag >::set_value ( const value_type v)
inline

set the current value

Definition at line 359 of file components.hpp.

359 { value = v; }

◆ set_value() [2/2]

template<typename InpT , typename Tag >
void tim::component::data_tracker< InpT, Tag >::set_value ( value_type &&  v)
inline

set the current value via move

Definition at line 362 of file components.hpp.

362 { value = std::move(v); }

◆ start()

template<typename InpT , typename Tag >
void tim::component::data_tracker< InpT, Tag >::start ( )
inline

Definition at line 204 of file components.hpp.

204 {}

◆ stop()

template<typename InpT , typename Tag >
void tim::component::data_tracker< InpT, Tag >::stop ( )
inline

Definition at line 205 of file components.hpp.

205 {}

◆ store() [1/4]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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 477 of file components.hpp.

481 {
482  handler_type::store(*this, std::forward<FuncT>(f),
483  compute_type::divide(std::forward<T>(val), get_unit()));
484  if(!get_is_running())
485  ++laps;
486 }
static void store(T &obj, const value_type &v)
this function is used to store a value
Definition: handler.hpp:79

References tim::math::divide(), and tim::invoke::store().

◆ store() [2/4]

template<typename InpT , typename Tag >
template<typename FuncT , typename T >
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 491 of file components.hpp.

496 {
497  handler_type::store(*this, std::forward<FuncT>(f),
498  compute_type::divide(std::forward<T>(val), get_unit()));
499  if(!get_is_running())
500  ++laps;
501 }

References tim::math::divide(), and tim::invoke::store().

◆ store() [3/4]

template<typename InpT , typename Tag >
template<typename T >
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 467 of file components.hpp.

468 {
469  handler_type::store(*this, compute_type::divide(std::forward<T>(val), get_unit()));
470  if(!get_is_running())
471  ++laps;
472 }

References tim::math::divide(), and tim::invoke::store().

◆ store() [4/4]

template<typename InpT , typename Tag >
template<typename T >
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 457 of file components.hpp.

458 {
459  handler_type::store(*this, compute_type::divide(std::forward<T>(val), get_unit()));
460  if(!get_is_running())
461  ++laps;
462 }

References tim::math::divide(), and tim::invoke::store().

Referenced by tim::component::data_tracker< InpT, Tag >::add_secondary().

Friends And Related Function Documentation

◆ operation::record< this_type >

template<typename InpT , typename Tag >
friend struct operation::record< this_type >
friend

Definition at line 632 of file components.hpp.

◆ operation::set_started< this_type >

template<typename InpT , typename Tag >
friend struct operation::set_started< this_type >
friend

Definition at line 632 of file components.hpp.

◆ operation::set_stopped< this_type >

template<typename InpT , typename Tag >
friend struct operation::set_stopped< this_type >
friend

Definition at line 632 of file components.hpp.

◆ operation::start< this_type >

template<typename InpT , typename Tag >
friend struct operation::start< this_type >
friend

Definition at line 632 of file components.hpp.

◆ operation::stop< this_type >

template<typename InpT , typename Tag >
friend struct operation::stop< this_type >
friend

Definition at line 632 of file components.hpp.


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