#include "timemory/components/papi/papi_common.hpp"
Definition at line 53 of file papi_common.hpp.
◆ tim::component::papi_common::common_data
struct tim::component::papi_common::common_data |
Definition at line 81 of file papi_common.hpp.
Class Members |
int |
event_set |
|
vector_t< int > |
events |
|
bool |
is_configured |
|
bool |
is_fixed |
|
◆ tim::component::papi_common::state_data
struct tim::component::papi_common::state_data |
Definition at line 70 of file papi_common.hpp.
Class Members |
bool |
is_finalized |
|
bool |
is_initialized |
|
bool |
is_working |
|
◆ array_t
◆ entry_type
◆ event_list
◆ get_initializer_t
◆ size_type
◆ value_type
◆ vector_t
◆ add_event()
static void tim::component::papi_common::add_event |
( |
int |
evt | ) |
|
|
inlinestatic |
◆ data()
static common_data & tim::component::papi_common::data |
( |
| ) |
|
|
inlinestatic |
◆ event_set()
static int & tim::component::papi_common::event_set |
( |
| ) |
|
|
inlinestatic |
◆ finalize()
static void tim::component::papi_common::finalize |
( |
| ) |
|
|
inlinestatic |
Definition at line 329 of file papi_common.hpp.
333 auto& _event_set = event_set<Tp>();
334 auto& _events = get_events<Tp>();
335 if(!_events.empty() && _event_set != PAPI_NULL && _event_set >= 0)
339 papi::remove_events(_event_set, _events.data(), _events.size());
340 papi::destroy_event_set(_event_set);
341 _event_set = PAPI_NULL;
void stop(TupleT< Tp... > &obj, Args &&... args)
static bool initialize_papi()
vector_t< long long > value_type
References initialize_papi(), and tim::invoke::stop().
◆ finalize_papi()
static bool tim::component::papi_common::finalize_papi |
( |
| ) |
|
|
inlinestatic |
◆ get_events()
static vector_t< int > & tim::component::papi_common::get_events |
( |
| ) |
|
|
inlinestatic |
Definition at line 125 of file papi_common.hpp.
127 auto&
_ret = data<Tp>().events;
128 if(!is_fixed<Tp>() &&
_ret.empty())
129 _ret = get_initializer<Tp>()();
const hash_alias_ptr_t hash_value_t std::string *& _ret
◆ get_initializer()
Definition at line 205 of file papi_common.hpp.
210 fprintf(stderr,
"[papi_common]> PAPI could not be initialized\n");
211 return vector_t<int>{};
218 printf(
"[papi_common]> TIMEMORY_PAPI_EVENTS: '%s'...\n",
223 vector_t<string_t> events_str_list =
delimit(events_str,
"\"',; ");
224 vector_t<int> events_list;
227 for(
int& pevent : pevents)
229 auto fitr = std::find(events_list.begin(), events_list.end(), pevent);
230 if(fitr == events_list.end())
231 events_list.push_back(pevent);
234 for(
const auto& itr : events_str_list)
236 if(itr.length() == 0)
241 printf(
"[papi_common]> Getting event code from '%s'...\n",
245 int evt_code = papi::get_event_code(itr);
246 if(evt_code == PAPI_NOT_INITED)
248 std::stringstream ss;
249 ss <<
"[papi_common] Error creating event with ID: " << itr;
256 fprintf(stderr,
"%s\n", ss.str().c_str());
262 std::find(events_list.begin(), events_list.end(), evt_code);
263 if(fitr == events_list.end())
267 printf(
"[papi_common] Successfully created event '%s' with "
269 itr.c_str(), evt_code);
271 events_list.push_back(evt_code);
277 printf(
"[papi_common] Event '%s' with code '%i' already "
279 itr.c_str(), evt_code);
ContainerT delimit(const std::string &line, const std::string &delimiters="\"',;: ", PredicateT &&predicate=[](const std::string &s) -> std::string { return s;})
std::function< event_list()> get_initializer_t
#define TIMEMORY_EXCEPTION(...)
References tim::debug, tim::delimit(), initialize_papi(), tim::papi_events, tim::papi_fail_on_error, private_events(), TIMEMORY_EXCEPTION, and tim::verbose.
◆ initialize()
static void tim::component::papi_common::initialize |
( |
| ) |
|
|
inlinestatic |
Definition at line 293 of file papi_common.hpp.
297 auto& _event_set = event_set<Tp>();
298 auto& _events = get_events<Tp>();
302 PRINT_HERE(
"configuring %i papi events", (
int) _events.size());
304 papi::add_events(_event_set, _events.data(), _events.size());
307 for(
auto itr : _events)
314 papi::attach(_event_set, process::get_target_id());
316 is_configured<Tp>() = papi::working();
318 if(!is_configured<Tp>())
320 PRINT_HERE(
"Warning! Configuring %i papi events failed",
321 (
int) _events.size());
void start(TupleT< Tp... > &obj, Args &&... args)
static void overflow_handler(int evt_set, void *address, long long overflow_vector, void *context)
References tim::debug, initialize_papi(), overflow_handler(), tim::papi_attach, tim::papi_multiplexing, tim::papi_overflow, PRINT_HERE, tim::invoke::start(), and tim::verbose.
◆ initialize_papi()
static bool tim::component::papi_common::initialize_papi |
( |
| ) |
|
|
inlinestatic |
Definition at line 155 of file papi_common.hpp.
157 if(!
state().is_initialized && !
state().is_working)
161 PRINT_HERE(
"Initializing papi. is initialized: %s, is working: %s",
162 state().is_initialized ?
"y" :
"n",
163 state().is_working ?
"y" :
"n");
166 papi::register_thread();
168 if(!
state().is_working)
170 std::cerr <<
"Warning! PAPI failed to initialized!\n";
171 std::cerr <<
"The following PAPI events will not be reported: \n";
172 for(
const auto& itr : get_events<void>())
173 std::cerr <<
" " << papi::get_event_info(itr).short_descr <<
"\n";
174 std::cerr << std::flush;
177 tpls::papi, papi_array_t, papi_common, papi_vector, papi_array8_t,
178 papi_array16_t, papi_array32_t>(
false);
void init(Args &&... args)
generic functions for setting/accessing static properties on types
References tim::debug, tim::init(), tim::component::papi_common::state_data::is_initialized, tim::component::papi_common::state_data::is_working, PRINT_HERE, state(), and tim::verbose.
Referenced by finalize(), get_initializer(), and initialize().
◆ is_configured()
static bool & tim::component::papi_common::is_configured |
( |
| ) |
|
|
inlinestatic |
◆ is_fixed()
static bool & tim::component::papi_common::is_fixed |
( |
| ) |
|
|
inlinestatic |
◆ overflow_handler()
static void tim::component::papi_common::overflow_handler |
( |
int |
evt_set, |
|
|
void * |
address, |
|
|
long long |
overflow_vector, |
|
|
void * |
context |
|
) |
| |
|
inlinestatic |
◆ private_events()
static vector_t< int > & tim::component::papi_common::private_events |
( |
| ) |
|
|
inlinestaticprotected |
◆ state()
static state_data & tim::component::papi_common::state |
( |
| ) |
|
|
inlinestatic |
◆ events
The documentation for this struct was generated from the following file: