|
PAPI
5.1.0.2
|
This file is part of the source code for a component that enables PAPI-C to access hardware monitoring counters for BG/Q through the bgpm library. More...


Go to the source code of this file.
Defines | |
| #define | CHECK_BGPM_ERROR(err, bgpmfunc) _check_BGPM_error( err, bgpmfunc ); |
| #define | STRINGIFY(x) #x |
| #define | TOSTRING(x) STRINGIFY(x) |
| #define | _AT_ __FILE__ ":" TOSTRING(__LINE__) |
| #define | MAX_COUNTERS ( PEVT_LAST_EVENT + 1 ) |
Functions | |
| void | _check_BGPM_error (int err, char *bgpmfunc) |
| long_long | _common_getEventValue (unsigned event_id, int EventGroup) |
| void | _common_deleteRecreate (int *EventGroup_ptr) |
| void | _common_rebuildEventgroup (int count, int *EventGroup_local, int *EventGroup_ptr) |
| void | _common_set_overflow_BGPM (int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *)) |
Definition at line 30 of file linux-bgq-common.h.
| #define CHECK_BGPM_ERROR | ( | err, | |
| bgpmfunc | |||
| ) | _check_BGPM_error( err, bgpmfunc ); |
Definition at line 25 of file linux-bgq-common.h.
| #define MAX_COUNTERS ( PEVT_LAST_EVENT + 1 ) |
Definition at line 34 of file linux-bgq-common.h.
Definition at line 28 of file linux-bgq-common.h.
| void _check_BGPM_error | ( | int | err, |
| char * | bgpmfunc | ||
| ) |
Definition at line 28 of file linux-bgq-common.c.
{
if ( err < 0 ) {
printf ( "Error: ret value is %d for BGPM API function '%s'.\n",
err, bgpmfunc);
}
}
| void _common_deleteRecreate | ( | int * | EventGroup_ptr | ) |
Definition at line 57 of file linux-bgq-common.c.
{
#ifdef DEBUG_BGQ
printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
#endif
int retval;
// delete previous bgpm eventset
retval = Bgpm_DeleteEventSet( *EventGroup_ptr );
CHECK_BGPM_ERROR( retval, "Bgpm_DeleteEventSet" );
// create a new empty bgpm eventset
*EventGroup_ptr = Bgpm_CreateEventSet();
CHECK_BGPM_ERROR( *EventGroup_ptr, "Bgpm_CreateEventSet" );
#ifdef DEBUG_BGQ
printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
#endif
}

| long_long _common_getEventValue | ( | unsigned | event_id, |
| int | EventGroup | ||
| ) |
Definition at line 41 of file linux-bgq-common.c.
{
uint64_t value;
int retval;
retval = Bgpm_ReadEvent( EventGroup, event_id, &value );
CHECK_BGPM_ERROR( retval, "Bgpm_ReadEvent" );
return ( ( long_long ) value );
}

| void _common_rebuildEventgroup | ( | int | count, |
| int * | EventGroup_local, | ||
| int * | EventGroup_ptr | ||
| ) |
Definition at line 82 of file linux-bgq-common.c.
{
#ifdef DEBUG_BGQ
printf( "_common_rebuildEventgroup\n" );
#endif
int i, retval;
// rebuild BGPM EventGroup
for ( i = 0; i < count; i++ ) {
retval = Bgpm_AddEvent( *EventGroup_ptr, EventGroup_local[i] );
CHECK_BGPM_ERROR( retval, "Bgpm_AddEvent" );
#ifdef DEBUG_BGQ
printf( "_common_rebuildEventgroup: After emptying EventGroup, event re-added: %d\n",
EventGroup_local[i] );
#endif
}
}

| void _common_set_overflow_BGPM | ( | int | EventGroup, |
| int | evt_idx, | ||
| int | threshold, | ||
| void(*)(int, uint64_t, uint64_t, const ucontext_t *) | handler | ||
| ) |
Definition at line 109 of file linux-bgq-common.c.
{
int retval;
uint64_t threshold_for_bgpm;
/* convert threadhold value assigned by PAPI user to value that is
* programmed into the counter. This value is required by Bgpm_SetOverflow() */
threshold_for_bgpm = BGPM_PERIOD2THRES( threshold );
#ifdef DEBUG_BGQ
printf("_common_set_overflow_BGPM\n");
int i;
int numEvts = Bgpm_NumEvents( EventGroup );
for ( i = 0; i < numEvts; i++ ) {
printf("_common_set_overflow_BGPM: %d = %s\n", i, Bgpm_GetEventLabel( EventGroup, i) );
}
#endif
retval = Bgpm_SetOverflow( EventGroup,
evt_idx,
threshold_for_bgpm );
CHECK_BGPM_ERROR( retval, "Bgpm_SetOverflow" );
retval = Bgpm_SetEventUser1( EventGroup,
evt_idx,
1024 );
CHECK_BGPM_ERROR( retval, "Bgpm_SetEventUser1" );
/* user signal handler for overflow case */
retval = Bgpm_SetOverflowHandler( EventGroup,
handler );
CHECK_BGPM_ERROR( retval, "Bgpm_SetOverflowHandler" );
}

