28 #include "timemory/components/papi/backends.hpp"
53 :
public base<papi_vector, std::vector<long long>>
57 template <
typename Tp>
71 using tracker_type::m_thr;
76 template <
typename... T>
79 template <
typename... T>
84 static auto&
get_initializer() {
return papi_common::get_initializer<common_type>(); }
87 if(!is_configured<common_type>())
88 papi_common::initialize<common_type>();
93 papi_common::finalize<common_type>();
96 static void finalize() { papi_common::finalize<common_type>(); }
102 events = get_events<common_type>();
103 value.resize(
events.size(), 0);
104 accum.resize(
events.size(), 0);
124 if(is_configured<common_type>())
125 papi::read(event_set<common_type>(), read_value.data());
131 template <
typename Tp =
double>
134 std::vector<Tp> values;
135 const auto& _data =
load();
136 for(
const auto& itr : _data)
137 values.push_back(itr);
138 values.resize(
events.size());
147 if(tracker_type::get_thread_started() == 0)
150 events = get_events<common_type>();
161 if(tracker_type::get_thread_started() == 0 ||
events.empty())
166 events = get_events<common_type>();
167 value.resize(
events.size(), 0);
168 accum.resize(
events.size(), 0);
179 value = (
record() - value);
216 return "papi_vector" + std::to_string((event_set<common_type>() < 0)
218 : event_set<common_type>());
223 return "Dynamically allocated array of PAPI HW counters";
228 return accum.at(evt_type);
234 template <
typename Archive>
235 void load(Archive& ar,
const unsigned int)
237 ar(cereal::make_nvp(
"laps",
laps), cereal::make_nvp(
"value", value),
238 cereal::make_nvp(
"accum", accum), cereal::make_nvp(
"events",
events));
244 template <
typename Archive>
245 void save(Archive& ar,
const unsigned int)
const
253 ar(cereal::make_nvp(
"laps",
laps), cereal::make_nvp(
"repr_data", _disp),
254 cereal::make_nvp(
"value", value), cereal::make_nvp(
"accum", accum),
255 cereal::make_nvp(
"display", _disp), cereal::make_nvp(
"events",
events));
265 arr[i] = papi::get_event_info(
events[i]).short_descr;
269 size_t n = std::string::npos;
270 while((n = itr.find(
"L/S")) != std::string::npos)
271 itr.replace(n, 3,
"Loads_Stores");
276 size_t n = std::string::npos;
277 while((n = itr.find(
'/')) != std::string::npos)
278 itr.replace(n, 1,
"_per_");
283 size_t n = std::string::npos;
284 while((n = itr.find(
' ')) != std::string::npos)
285 itr.replace(n, 1,
"_");
287 while((n = itr.find(
"__")) != std::string::npos)
288 itr.replace(n, 2,
"_");
301 arr[i] = papi::get_event_info(
events[i]).long_descr;
312 arr[i] = papi::get_event_info(
events[i]).units;
334 auto _get_display = [&](std::ostream& os,
size_type idx) {
335 auto _obj_value = val.at(idx);
336 auto _evt_type =
events.at(idx);
337 string_t _label = papi::get_event_info(_evt_type).short_descr;
338 string_t _disp = papi::get_event_info(_evt_type).units;
343 std::stringstream ss;
344 std::stringstream ssv;
345 std::stringstream ssi;
347 ssv << std::setw(_width) << std::setprecision(_prec) << _obj_value;
351 ssi <<
" " << _label;
352 ss << ssv.str() << ssi.str();
356 std::stringstream ss;
380 std::stringstream ss_value;
381 std::stringstream ss_extra;
382 ss_value.setf(_flags);
383 ss_value << std::setw(_width) << std::setprecision(_prec) << _value;
386 ss_extra <<
" " << _disp;
388 else if(!_label.empty())
390 ss_extra <<
" " << _label;
392 os << ss_value.str() << ss_extra.str();
Declare the papi component types.
void stop(TupleT< Tp... > &obj, Args &&... args)
void start(TupleT< Tp... > &obj, Args &&... args)
Inherit from this policy to add reference counting support. Useful if you want to turn a global setti...
tim::mpl::apply< std::string > string
static short get_precision()
static std::string get_label()
static std::string display_unit()
static fmtflags get_format_flags()
storage< Tp, Value > storage_type
Combines hardware counters and timers and executes the empirical roofline toolkit during application ...
Combines hardware counters and timers and executes the empirical roofline toolkit during application ...
typename value_type::value_type entry_type
static bool finalize_papi()
std::vector< Tp > vector_t
std::function< event_list()> get_initializer_t
vector_t< int > event_list
vector_t< long long > value_type
vector_t< int > event_list
static std::string description()
static std::string label()
papi_vector(const papi_vector &)=default
void save(Archive &ar, const unsigned int) const
vector_t< std::string > description_array() const
vector_t< std::string > label_array() const
vector_t< Tp > get() const
static auto & get_initializer()
void load(Archive &ar, const unsigned int)
papi_vector(papi_vector &&) noexcept=default
vector_t< std::string > display_unit_array() const
this_type & operator+=(const this_type &rhs)
vector_t< int64_t > unit_array() const
entry_type get_display(int evt_type) const
this_type & operator-=(const this_type &rhs)
static void thread_finalize()
static const short precision
string_t get_display() const
typename base_type::storage_type storage_type
friend std::ostream & operator<<(std::ostream &os, const this_type &obj)