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::operation::add_statistics< T > Struct Template Reference

Enabling statistics in timemory has two parts: More...

#include "timemory/operations/types/add_statistics.hpp"

+ Collaboration diagram for tim::operation::add_statistics< T >:

Public Types

using type = T
 

Public Member Functions

template<typename StatsT >
 add_statistics (const type &_obj, StatsT &_stats, bool _last=false)
 
 add_statistics (const type &_obj, bool _last=false)
 
template<typename U >
auto operator() (const U &rhs, bool _last=false) const
 
template<typename StatsT , typename U = type>
void operator() (const U &rhs, StatsT &stats, bool _last=false, enable_if_t< enabled_statistics< U, StatsT >::value, int >=0) const
 
template<typename StatsT , typename U = type>
void operator() (const U &, StatsT &, bool=true, enable_if_t<!enabled_statistics< U, StatsT >::value, int >=0) const
 

Detailed Description

template<typename T>
struct tim::operation::add_statistics< T >

Enabling statistics in timemory has two parts:

  1. tim::trait::record_statistics must be set to true for component
  2. tim::trait::statistics must set the data type of the statistics
    • this is usually set to the data type returned from get()
    • tuple<> is the default and will fully disable statistics unless changed

Definition at line 114 of file add_statistics.hpp.

Member Typedef Documentation

◆ type

template<typename T >
using tim::operation::add_statistics< T >::type = T

Definition at line 116 of file add_statistics.hpp.

Constructor & Destructor Documentation

◆ add_statistics() [1/2]

template<typename T >
template<typename StatsT >
tim::operation::add_statistics< T >::add_statistics ( const type _obj,
StatsT &  _stats,
bool  _last = false 
)
inline

Definition at line 124 of file add_statistics.hpp.

125 {
126 (*this)(_obj, _stats, _last);
127 }

◆ add_statistics() [2/2]

template<typename T >
tim::operation::add_statistics< T >::add_statistics ( const type _obj,
bool  _last = false 
)
inline

Definition at line 132 of file add_statistics.hpp.

133 {
134 (*this)(_obj, _last);
135 }

Member Function Documentation

◆ operator()() [1/3]

template<typename T >
template<typename StatsT , typename U = type>
void tim::operation::add_statistics< T >::operator() ( const U &  ,
StatsT &  ,
bool  = true,
enable_if_t<!enabled_statistics< U, StatsT >::value, int >  = 0 
) const
inline

Definition at line 158 of file add_statistics.hpp.

161 {}

◆ operator()() [2/3]

template<typename T >
template<typename U >
auto tim::operation::add_statistics< T >::operator() ( const U &  rhs,
bool  _last = false 
) const
inline

Definition at line 141 of file add_statistics.hpp.

142 {
143 return sfinae(rhs, 0, 0, _last);
144 }

◆ operator()() [3/3]

template<typename T >
template<typename StatsT , typename U >
void tim::operation::add_statistics< T >::operator() ( const U &  rhs,
StatsT &  stats,
bool  _last = false,
enable_if_t< enabled_statistics< U, StatsT >::value, int >  = 0 
) const

Definition at line 195 of file add_statistics.hpp.

198{
199 // for type comparison
200 using incoming_t = decay_t<typename StatsT::value_type>;
201 using expected_t = decay_t<typename trait::statistics<U>::type>;
202 // check the incomming stat type against declared stat type
203 // but allow for permissive_statistics when there is an acceptable
204 // implicit conversion
205 static_assert(trait::permissive_statistics<U>::value ||
206 std::is_same<incoming_t, expected_t>::value,
207 "add_statistics was passed a data type different than declared "
208 "trait::statistics type. To disable this error, e.g. permit "
209 "implicit conversion, set trait::permissive_statistics "
210 "to true_type for component");
211 using stats_policy_type = policy::record_statistics<U>;
212 DEBUG_PRINT_HERE("%s :: updating %s (accum: %s)", demangle<U>().c_str(),
213 demangle<StatsT>().c_str(), (_last) ? "y" : "n");
214 stats_policy_type{}(stats, rhs, _last);
215}
#define DEBUG_PRINT_HERE(...)
Definition: macros.hpp:168

References DEBUG_PRINT_HERE.


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