39 printf(
"L2UNIT_init_thread\n" );
55 printf(
"L2UNIT_init_component\n" );
60 printf(
"L2UNIT_init_component cidx = %d\n",
cidx );
75 printf(
"L2UNIT_init_control_state\n" );
81 this_state->
EventGroup = Bgpm_CreateEventSet();
102 printf(
"L2UNIT_start\n" );
132 printf(
"L2UNIT_stop\n" );
154 printf(
"L2UNIT_read\n" );
161 numEvts = Bgpm_NumEvents( this_state->
EventGroup );
162 if ( numEvts == 0 ) {
164 printf (
"Error: ret value is %d for BGPM API function Bgpm_NumEvents.\n", numEvts );
169 for (
i = 0;
i < numEvts;
i++ )
185 printf(
"L2UNIT_shutdown_thread\n" );
205 printf(
"user_signal_handler_L2UNIT\n" );
220 unsigned ovfIdxs[BGPM_MAX_OVERFLOW_EVENTS];
221 unsigned len = BGPM_MAX_OVERFLOW_EVENTS;
223 retval = Bgpm_GetOverflowEventIndices( hEvtSet, ovfVector, ovfIdxs, &len );
226 printf (
"Error: ret value is %d for BGPM API function Bgpm_GetOverflowEventIndices.\n",
233 PAPIERROR(
"thread == NULL in user_signal_handler!" );
238 PAPIERROR(
"ESI == NULL in user_signal_handler!");
243 PAPIERROR(
"ESI->overflow.flags == 0 in user_signal_handler!");
247 for (
i = 0;
i < len;
i++ ) {
249 Bgpm_GetEventUser1( hEvtSet, ovfIdxs[
i], &hProf );
251 overflow_bit ^= 1 << ovfIdxs[
i];
259 printf(
"OVERFLOW_SOFTWARE\n");
267 printf(
"OVERFLOW_HARDWARE\n");
274 printf(
"OVERFLOW_NONE\n");
276 PAPIERROR(
"ESI->overflow.flags is set to something other than PAPI_OVERFLOW_HARDWARE or PAPI_OVERFLOW_FORCE_SW (%#x)",
thread->running_eventset[
cidx]->overflow.flags);
293 printf(
"BEGIN L2UNIT_set_overflow\n");
305 printf(
"L2UNIT_set_overflow: bgpm_eventset_applied = %d, threshold = %d\n",
322 SUBDBG(
"Hardware counter %d (vs %d) used in overflow, threshold %d\n",
325 printf(
"Hardware counter %d (vs %d) used in overflow, threshold %d\n",
342 printf(
"L2UNIT_set_overflow: Enable the signal handler\n" );
371 printf(
"L2UNIT_ctl\n" );
389 printf(
"L2UNIT_cleanup_eventset\n" );
420 printf(
"L2UNIT_update_control_state: count = %d\n",
count );
432 printf(
"L2UNIT_update_control_state: EventGroup=%d, overflow = %d\n",
444 printf(
"L2UNIT_update_control_state: ADD event: i = %d, index = %d\n",
i, index );
489 printf(
"L2UNIT_set_domain\n" );
517 printf(
"L2UNIT_reset\n" );
549 switch ( modifier ) {
558 int index = ( *EventCode ) +
OFFSET;
561 *EventCode = *EventCode + 1;
582 printf(
"L2UNIT_ntv_name_to_code\n" );
587 ret = Bgpm_GetEventIdFromLabel (
name );
591 printf (
"Error: ret value is %d for BGPM API function '%s'.\n",
592 ret,
"Bgpm_GetEventIdFromLabel" );
599 *event_code = ( ret -
OFFSET );
616 index = ( EventCode ) +
OFFSET;
621 strncpy(
name, Bgpm_GetEventIdLabel( index ), len );
623 if (
name == NULL ) {
625 printf (
"Error: ret value is NULL for BGPM API function Bgpm_GetEventIdLabel.\n" );
645 index = ( EventCode ) +
OFFSET;
647 retval = Bgpm_GetLongDesc( index,
name, &len );
662 printf(
"L2UNIT_ntv_code_to_bits\n" );
676 .
name =
"bgpm/L2Unit",
677 .short_name =
"L2Unit",
678 .description =
"Blue Gene/Q L2Unit component",
690 .kernel_multiplex = 0,
693 .fast_real_timer = 0,
694 .fast_virtual_timer = 0,
696 .attach_must_ptrace = 0,
#define GET_OVERFLOW_ADDRESS(ctx)
#define PAPI_OVERFLOW_FORCE_SW
#define PAPI_OVERFLOW_HARDWARE
char events[MAX_EVENTS][BUFSIZ]
int L2UNIT_update_control_state(hwd_control_state_t *ptr, NativeInfo_t *native, int count, hwd_context_t *ctx)
int L2UNIT_stop(hwd_context_t *ctx, hwd_control_state_t *ptr)
int L2UNIT_shutdown_thread(hwd_context_t *ctx)
int L2UNIT_init_component(int cidx)
int L2UNIT_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
int L2UNIT_cleanup_eventset(hwd_control_state_t *ctrl)
int L2UNIT_init_thread(hwd_context_t *ctx)
int L2UNIT_ntv_name_to_code(const char *name, unsigned int *event_code)
void user_signal_handler_L2UNIT(int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext)
int L2UNIT_reset(hwd_context_t *ctx, hwd_control_state_t *ptr)
int L2UNIT_ntv_enum_events(unsigned int *EventCode, int modifier)
int L2UNIT_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
int L2UNIT_start(hwd_context_t *ctx, hwd_control_state_t *ptr)
int L2UNIT_ntv_code_to_name(unsigned int EventCode, char *name, int len)
papi_vector_t _L2unit_vector
int L2UNIT_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
int L2UNIT_read(hwd_context_t *ctx, hwd_control_state_t *ptr, long_long **events, int flags)
int L2UNIT_set_domain(hwd_control_state_t *cntrl, int domain)
int L2UNIT_init_control_state(hwd_control_state_t *ptr)
int L2UNIT_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
This file has the source code for a component that enables PAPI-C to access hardware monitoring count...
#define L2UNIT_MAX_EVENTS
#define L2UNIT_MAX_COUNTERS
int _common_set_overflow_BGPM(int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *))
int _common_deleteRecreate(int *EventGroup_ptr)
int _common_rebuildEventgroup(int count, int *EventGroup_local, int *EventGroup_ptr)
long_long _common_getEventValue(unsigned event_id, int EventGroup)
int _check_BGPM_error(int err, char *bgpmfunc)
#define SUBDBG(format, args...)
void PAPIERROR(char *format,...)
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
EventInfo_t * EventInfoArray
hwd_control_state_t * ctl_state
EventSetOverflowInfo_t overflow
L2UNIT_overflow_t overflow_list[512]
int bgpm_eventset_applied
long long counters[L2UNIT_MAX_COUNTERS]
int EventGroup_local[512]
char name[PAPI_MAX_STR_LEN]
hwd_ucontext_t * ucontext
PAPI_component_info_t cmp_info
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)