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::print< Tp > Struct Template Reference

print routines for individual components More...

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

+ Collaboration diagram for tim::operation::print< Tp >:

Public Types

using type = Tp
 
using widths_t = std::vector< int64_t >
 

Public Member Functions

template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
 print (const type &_obj, std::ostream &_os, bool _endline=false)
 
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
 print (std::size_t N, std::size_t Ntot, const type &_obj, std::ostream &_os, bool _endline)
 
template<typename Vp , typename Statp , typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
 print (const type &_obj, utility::stream &_os, const string_t &_prefix, int64_t _laps, int64_t _depth, const Vp &_self, const Statp &_stats)
 
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
 print (const type *_obj, std::ostream &_os, bool _endline=false)
 
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
 print (std::size_t N, std::size_t Ntot, const type *_obj, std::ostream &_os, bool _endline)
 
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
 print (const type *_obj, std::ostream &_os, const string_t &_prefix, int64_t _laps, int64_t _depth, const widths_t &_output_widths, bool _endline, const string_t &_suffix="")
 
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
 print (const type &, std::ostream &, bool=false)
 
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
 print (std::size_t, std::size_t, const type &, std::ostream &, bool)
 
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
 print (const type &, std::ostream &, const string_t &, int64_t, int64_t, const widths_t &, bool, const string_t &="")
 
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
 print (const type *, std::ostream &, bool=false)
 
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
 print (std::size_t, std::size_t, const type *, std::ostream &, bool)
 
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
 print (const type *, std::ostream &, const string_t &, int64_t, int64_t, const widths_t &, bool, const string_t &="")
 

Detailed Description

template<typename Tp>
struct tim::operation::print< Tp >

print routines for individual components

Definition at line 58 of file print.hpp.

Member Typedef Documentation

◆ type

template<typename Tp >
using tim::operation::print< Tp >::type = Tp

Definition at line 60 of file print.hpp.

◆ widths_t

template<typename Tp >
using tim::operation::print< Tp >::widths_t = std::vector<int64_t>

Definition at line 61 of file print.hpp.

Constructor & Destructor Documentation

◆ print() [1/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type _obj,
std::ostream &  _os,
bool  _endline = false 
)
inline

Definition at line 65 of file print.hpp.

66 {
68 return;
69
70 if(operation::get_is_invalid<Up, false>{}(_obj))
71 return;
72
73 std::stringstream ss;
74 ss << _obj;
75 if(_endline)
76 ss << '\n';
77 _os << ss.str();
78 }
static bool get(enable_if_t< is_available< U >::value &&get_value< U >(), int >=0)
GET specialization if component is available.

Referenced by tim::operation::print< Tp >::print().

◆ print() [2/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( std::size_t  N,
std::size_t  Ntot,
const type _obj,
std::ostream &  _os,
bool  _endline 
)
inline

Definition at line 81 of file print.hpp.

83 {
85 return;
86
87 if(operation::get_is_invalid<Up, false>{}(_obj))
88 return;
89
90 std::stringstream ss;
91 ss << _obj;
92 if(N + 1 < Ntot)
93 {
94 ss << ", ";
95 }
96 else if(N + 1 == Ntot && _endline)
97 {
98 ss << '\n';
99 }
100 _os << ss.str();
101 }

◆ print() [3/12]

template<typename Tp >
template<typename Vp , typename Statp , typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type _obj,
utility::stream _os,
const string_t _prefix,
int64_t  _laps,
int64_t  _depth,
const Vp &  _self,
const Statp &  _stats 
)
inline

Definition at line 105 of file print.hpp.

108 {
109 auto _labels = common_utils::get_labels(_obj);
110 auto _units = common_utils::get_display_units(_obj);
111
112 if(operation::get_is_invalid<Up, false>{}(_obj))
113 return;
114
115 utility::write_entry(_os, "LABEL", _prefix);
116
117 if(_laps > 0)
118 {
120 utility::write_entry(_os, "COUNT", _laps);
122 utility::write_entry(_os, "DEPTH", _depth);
124 utility::write_entry(_os, "METRIC", _labels, true);
126 utility::write_entry(_os, "UNITS", _units, true);
128 utility::write_entry(_os, "SUM", _obj.get());
130 utility::write_entry(_os, "MEAN", _obj.get() / _obj.get_laps());
132 print_statistics<Tp>(_obj, _os, _self, _stats, _laps);
134 utility::write_entry(_os, "% SELF", _self);
135 }
136 else
137 {
138 std::string _filler = "-";
139 std::vector<std::string> _empty_data(_labels.size(), _filler);
141 utility::write_entry(_os, "COUNT", _filler);
143 utility::write_entry(_os, "DEPTH", _depth);
145 utility::write_entry(_os, "METRIC", _empty_data);
147 utility::write_entry(_os, "UNITS", _empty_data);
149 utility::write_entry(_os, "SUM", _empty_data);
151 utility::write_entry(_os, "MEAN", _empty_data);
153 {
155 utility::write_entry(_os, "MIN", _empty_data);
157 utility::write_entry(_os, "MAX", _empty_data);
159 utility::write_entry(_os, "VAR", _empty_data);
161 utility::write_entry(_os, "STDDEV", _empty_data);
162 }
164 utility::write_entry(_os, "% SELF", _empty_data);
165 }
166 }
auto write_entry(Args &&... args)
Definition: stream.hpp:996
char const std::string & _prefix
Definition: config.cpp:55
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
static strvec_t get_labels(const Tp &_data)
static strvec_t get_display_units(const Tp &_data)
static bool max()
static bool sum()
static bool stddev()
static bool variance()
static bool units()
static bool stats()
static bool metric()
static bool count()
static bool mean()
static bool min()
static bool self()
static bool depth()

References tim::_prefix, tim::operation::common_utils::get_display_units(), tim::operation::common_utils::get_labels(), and tim::utility::write_entry().

◆ print() [4/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type _obj,
std::ostream &  _os,
bool  _endline = false 
)
inline

Definition at line 172 of file print.hpp.

173 {
175 return;
176
177 if(_obj && !operation::get_is_invalid<Up, false>{}(*_obj))
178 print(*_obj, _os, _endline);
179 }
print(const type &_obj, std::ostream &_os, bool _endline=false)
Definition: print.hpp:65

References tim::operation::print< Tp >::print().

◆ print() [5/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( std::size_t  N,
std::size_t  Ntot,
const type _obj,
std::ostream &  _os,
bool  _endline 
)
inline

Definition at line 182 of file print.hpp.

184 {
186 return;
187
188 if(_obj && !operation::get_is_invalid<Up, false>{}(*_obj))
189 print(N, Ntot, *_obj, _os, _endline);
190 }

References tim::operation::print< Tp >::print().

◆ print() [6/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t< is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type _obj,
std::ostream &  _os,
const string_t _prefix,
int64_t  _laps,
int64_t  _depth,
const widths_t _output_widths,
bool  _endline,
const string_t _suffix = "" 
)
inline

Definition at line 193 of file print.hpp.

196 {
198 return;
199
200 if(_obj && !operation::get_is_invalid<Up, false>{}(*_obj))
201 print(*_obj, _os, _prefix, _laps, _depth, _output_widths, _endline, _suffix);
202 }
char const std::string const std::string & _suffix
Definition: config.cpp:57

References tim::operation::print< Tp >::print(), tim::_prefix, and tim::_suffix.

◆ print() [7/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type ,
std::ostream &  ,
bool  = false 
)
inline

Definition at line 208 of file print.hpp.

209 {}

◆ print() [8/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( std::size_t  ,
std::size_t  ,
const type ,
std::ostream &  ,
bool   
)
inline

Definition at line 212 of file print.hpp.

213 {}

◆ print() [9/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type ,
std::ostream &  ,
const string_t ,
int64_t  ,
int64_t  ,
const widths_t ,
bool  ,
const string_t = "" 
)
inline

Definition at line 216 of file print.hpp.

218 {}

◆ print() [10/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type ,
std::ostream &  ,
bool  = false 
)
inline

Definition at line 224 of file print.hpp.

225 {}

◆ print() [11/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( std::size_t  ,
std::size_t  ,
const type ,
std::ostream &  ,
bool   
)
inline

Definition at line 228 of file print.hpp.

229 {}

◆ print() [12/12]

template<typename Tp >
template<typename Up = Tp, enable_if_t<!is_enabled< Up >::value, char > = 0>
tim::operation::print< Tp >::print ( const type ,
std::ostream &  ,
const string_t ,
int64_t  ,
int64_t  ,
const widths_t ,
bool  ,
const string_t = "" 
)
inline

Definition at line 232 of file print.hpp.

234 {}

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