28#include "timemory/components/papi/backends.hpp"
73template <
typename RateT,
int... EventTypes>
75:
public base<papi_rate_tuple<RateT, EventTypes...>,
76 std::pair<papi_tuple<EventTypes...>, RateT>>
80 "Error! rate_type must be a component");
93 template <
typename Tp>
94 using array_t = std::array<Tp, num_events>;
144 "Reports the rate of the given set of HW counters w.r.t. the ") +
145 rate_type::label() +
" component";
156 value.second.start();
167 value.first += rhs.value.first;
168 value.second += rhs.value.second;
174 value.first -= rhs.value.first;
175 value.second -= rhs.value.second;
179 template <
typename Tp =
double>
182 auto _val = value.first.template get<Tp>();
183 for(
auto& itr : _val)
184 itr /= value.second.get();
192 itr +=
" per " + rate_type::get_display_unit();
211 itr +=
"/" + rate_type::display_unit();
218 std::array<double, num_events> arr;
220 for(
size_t i = 0; i < _units.size(); ++i)
221 arr.at(i) = _units.at(i);
222 for(
auto& itr : _units)
223 itr /= rate_type::unit();
230 auto _value = obj.
get();
237 for(
size_t i = 0; i < _value.size(); ++i)
239 std::stringstream ss_value;
240 std::stringstream ss_extra;
241 ss_value.setf(_flags);
242 ss_value << std::setw(_width) << std::setprecision(_prec) << _value.at(i);
243 if(!_disp.at(i).empty())
245 ss_extra <<
" " << _disp.at(i);
247 else if(!_label.at(i).empty())
249 ss_extra <<
" " << _label.at(i);
251 os << ss_value.str() << ss_extra.str();
252 if(i + 1 < _value.size())
259 using base_type::accum;
263 using base_type::value;
267 trait::uses_value_storage<this_type, value_type>::value>;
Declare the papi component types.
Definition for global and thread-local finalization functions for a component.
Definition for global and thread-local initialzation functions for a component.
std::integral_constant< int, ModeV > mode_constant
tim::mpl::apply< std::string > string
const std::string std::ostream * os
static short get_precision()
void set_stopped()
store that stop has been called
static fmtflags get_format_flags()
storage< Tp, Value > storage_type
void set_started()
store that start has been called
A very lightweight storage class which provides nothing.
std::array< Tp, N > array_t
vector_t< long long > value_type
This component pairs a tim::component::papi_tuple with a component which will provide an interval ove...
static void global_finalize()
static auto description_array()
papi_tuple< EventTypes... > tuple_type
static auto label_array()
static auto display_unit_array()
friend std::ostream & operator<<(std::ostream &os, const this_type &obj)
std::pair< tuple_type, rate_type > value_type
this_type & operator+=(const this_type &rhs)
static std::string description()
this_type & operator-=(const this_type &rhs)
static const size_type num_events
static std::string label()
static void thread_init()
static void global_init()
static void thread_finalize()
papi_rate_tuple< RateT, EventTypes... > this_type
This component is useful for bundling together a fixed set of hardware counter identifiers which requ...
static std::string label()
static array_t< std::string > description_array()
static array_t< std::string > label_array()
static array_t< int64_t > unit_array()
static constexpr const char * id()
concept that specifies that a type is a component. Components are used to perform some measurement,...
This operation class is used for invoking the static initializer and thread-local initializer of a co...
This operation attempts to call a member function which the component provides to internally store wh...
This operation attempts to call a member function which the component provides to internally store wh...