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::data::handler< V, Tag > Struct Template Reference

#include "timemory/data/handler.hpp"

+ Collaboration diagram for tim::data::handler< V, Tag >:

Public Types

using value_type = V
 

Static Public Member Functions

template<typename T >
static decltype(auto) get (const T &obj)
 this function is returns the current value More...
 
template<typename T >
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 specialize this function downstream. More...
 
template<typename T >
static void store (T &obj, const value_type &v)
 this function is used to store a value More...
 
template<typename T , typename FuncT >
static auto store (T &obj, FuncT &&f, const value_type &v) -> decltype(obj.set_value(std::forward< FuncT >(f)(obj.get_value(), v)), void())
 
static void begin (value_type &obj, const value_type &v)
 this function sets the value of the temporary in mark_begin. More...
 
template<typename FuncT >
static void begin (value_type &obj, FuncT &&f, const value_type &v)
 this function sets the value of the temporary in mark_begin. More...
 
template<typename T >
static void end (T &obj, const value_type &v)
 this function computes the difference between the provided value and the temporary from mark_begin and then updates the current value More...
 
template<typename T , typename FuncT >
static void end (T &obj, FuncT &&f, const value_type &v)
 this function computes the difference between the provided value and the temporary from mark_begin and then updates the current value More...
 
template<typename T >
static void store (T &obj, value_type &&v)
 overload with move semantics More...
 
template<typename T , typename FuncT >
static auto store (T &obj, FuncT &&f, value_type &&v) -> decltype(obj.set_value(std::forward< FuncT >(f)(obj.get_value(), std::move(v))), void())
 overload with move semantics More...
 
static void begin (value_type &obj, value_type &&v)
 overload with move semantics More...
 
template<typename T , typename FuncT >
static auto begin (value_type &obj, FuncT &&f, value_type &&v)
 overload with move semantics More...
 
template<typename T >
static void end (T &obj, value_type &&v)
 overload with move semantics More...
 
template<typename T , typename FuncT >
static void end (T &obj, FuncT &&f, value_type &&v)
 overload with move semantics More...
 

Detailed Description

template<typename V, typename Tag>
struct tim::data::handler< V, Tag >

Definition at line 53 of file handler.hpp.

Member Typedef Documentation

◆ value_type

template<typename V , typename Tag >
using tim::data::handler< V, Tag >::value_type = V

Definition at line 55 of file handler.hpp.

Member Function Documentation

◆ begin() [1/4]

template<typename V , typename Tag >
static void tim::data::handler< V, Tag >::begin ( value_type obj,
const value_type v 
)
inlinestatic

this function sets the value of the temporary in mark_begin.

Definition at line 94 of file handler.hpp.

94{ obj = v; }

◆ begin() [2/4]

template<typename V , typename Tag >
template<typename FuncT >
static void tim::data::handler< V, Tag >::begin ( value_type obj,
FuncT &&  f,
const value_type v 
)
inlinestatic

this function sets the value of the temporary in mark_begin.

Definition at line 98 of file handler.hpp.

99 {
100 obj = std::forward<FuncT>(f)(obj, v);
101 }

◆ begin() [3/4]

template<typename V , typename Tag >
template<typename T , typename FuncT >
static auto tim::data::handler< V, Tag >::begin ( value_type obj,
FuncT &&  f,
value_type &&  v 
)
inlinestatic

overload with move semantics

Definition at line 148 of file handler.hpp.

149 {
150 obj = std::forward<FuncT>(f)(obj, v);
151 }

◆ begin() [4/4]

template<typename V , typename Tag >
static void tim::data::handler< V, Tag >::begin ( value_type obj,
value_type &&  v 
)
inlinestatic

overload with move semantics

Definition at line 144 of file handler.hpp.

144{ obj = v; }

◆ end() [1/4]

template<typename V , typename Tag >
template<typename T >
static void tim::data::handler< V, Tag >::end ( T &  obj,
const value_type v 
)
inlinestatic

this function computes the difference between the provided value and the temporary from mark_begin and then updates the current value

Definition at line 106 of file handler.hpp.

107 {
108 auto _v = v;
109 _v = math::minus(_v, obj.get_temporary());
110 store(obj, std::move(_v));
111 }
Tp & minus(Tp &, const Up &)
Definition: minus.hpp:98
static void store(T &obj, const value_type &v)
this function is used to store a value
Definition: handler.hpp:79

References tim::math::minus(), and tim::data::handler< V, Tag >::store().

◆ end() [2/4]

template<typename V , typename Tag >
template<typename T , typename FuncT >
static void tim::data::handler< V, Tag >::end ( T &  obj,
FuncT &&  f,
const value_type v 
)
inlinestatic

this function computes the difference between the provided value and the temporary from mark_begin and then updates the current value

Definition at line 116 of file handler.hpp.

117 {
118 auto _v = v;
119 _v = math::minus(_v, obj.get_temporary());
120 store(obj, std::forward<FuncT>(f), std::move(_v));
121 }

References tim::math::minus(), and tim::data::handler< V, Tag >::store().

◆ end() [3/4]

template<typename V , typename Tag >
template<typename T , typename FuncT >
static void tim::data::handler< V, Tag >::end ( T &  obj,
FuncT &&  f,
value_type &&  v 
)
inlinestatic

overload with move semantics

Definition at line 164 of file handler.hpp.

165 {
166 auto&& _v = std::move(v);
167 _v = math::minus(_v, obj.get_temporary());
168 store(obj, std::forward<FuncT>(f), std::move(_v));
169 }

References tim::math::minus(), and tim::data::handler< V, Tag >::store().

◆ end() [4/4]

template<typename V , typename Tag >
template<typename T >
static void tim::data::handler< V, Tag >::end ( T &  obj,
value_type &&  v 
)
inlinestatic

overload with move semantics

Definition at line 155 of file handler.hpp.

156 {
157 auto&& _v = std::move(v);
158 math::minus(_v, obj.get_temporary());
159 obj.set_value(std::move(_v));
160 }

References tim::math::minus().

◆ get()

template<typename V , typename Tag >
template<typename T >
static decltype(auto) tim::data::handler< V, Tag >::get ( const T &  obj)
inlinestatic

this function is returns the current value

Definition at line 60 of file handler.hpp.

61 {
62 return handler::get(obj, 0);
63 }
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().

Referenced by tim::component::data_tracker< InpT, Tag >::get(), tim::data::handler< V, Tag >::get(), and tim::data::handler< V, Tag >::get_display().

◆ get_display()

template<typename V , typename Tag >
template<typename T >
static decltype(auto) tim::data::handler< V, Tag >::get_display ( const T &  obj)
inlinestatic

this function is returns the current value in a form suitable for display. It may be necessary to specialize this function downstream.

Definition at line 68 of file handler.hpp.

69 {
70 return handler::get(obj);
71 }

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

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

◆ store() [1/4]

template<typename V , typename Tag >
template<typename T >
static void tim::data::handler< V, Tag >::store ( T &  obj,
const value_type v 
)
inlinestatic

this function is used to store a value

Definition at line 79 of file handler.hpp.

80 {
81 obj.set_value(v);
82 }

Referenced by tim::data::handler< V, Tag >::end().

◆ store() [2/4]

template<typename V , typename Tag >
template<typename T , typename FuncT >
static auto tim::data::handler< V, Tag >::store ( T &  obj,
FuncT &&  f,
const value_type v 
) -> decltype(obj.set_value(std::forward<FuncT>(f)(obj.get_value(), v)), void())
inlinestatic
Template Parameters
FuncTShould be binary operation which takes two inputs and returns one this function is used to store the current value after performing some operation.

Definition at line 87 of file handler.hpp.

89 {
90 obj.set_value(std::forward<FuncT>(f)(obj.get_value(), v));
91 }

◆ store() [3/4]

template<typename V , typename Tag >
template<typename T , typename FuncT >
static auto tim::data::handler< V, Tag >::store ( T &  obj,
FuncT &&  f,
value_type &&  v 
) -> decltype(obj.set_value(std::forward<FuncT>(f)(obj.get_value(), std::move(v))), void())
inlinestatic

overload with move semantics

Definition at line 136 of file handler.hpp.

139 {
140 obj.set_value(std::forward<FuncT>(f)(obj.get_value(), std::move(v)));
141 }

◆ store() [4/4]

template<typename V , typename Tag >
template<typename T >
static void tim::data::handler< V, Tag >::store ( T &  obj,
value_type &&  v 
)
inlinestatic

overload with move semantics

Definition at line 129 of file handler.hpp.

130 {
131 obj.set_value(std::move(v));
132 }

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