linux-bgq-common.h File Reference

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...

Include dependency graph for linux-bgq-common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define STRINGIFY(x)   #x
#define TOSTRING(x)   STRINGIFY(x)
#define _AT_   __FILE__ ":" TOSTRING(__LINE__)
#define MAX_COUNTERS   ( PEVT_LAST_EVENT + 1 )

Functions

int _papi_hwi_publish_error (char *error)
int _check_BGPM_error (int err, char *bgpmfunc)
long_long _common_getEventValue (unsigned event_id, int EventGroup)
int _common_deleteRecreate (int *EventGroup_ptr)
int _common_rebuildEventgroup (int count, int *EventGroup_local, int *EventGroup_ptr)
int _common_set_overflow_BGPM (int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *))

Detailed Description

CVS: $Id$

Author:
Heike Jagode jagode@eecs.utk.edu Mods: < your name here > < your email address > BGPM component

Tested version of bgpm (early access)

Definition in file linux-bgq-common.h.


Define Documentation

#define _AT_   __FILE__ ":" TOSTRING(__LINE__)

Definition at line 30 of file linux-bgq-common.h.

#define MAX_COUNTERS   ( PEVT_LAST_EVENT + 1 )

Definition at line 34 of file linux-bgq-common.h.

#define STRINGIFY ( x   )     #x

Definition at line 28 of file linux-bgq-common.h.

#define TOSTRING ( x   )     STRINGIFY(x)

Definition at line 29 of file linux-bgq-common.h.


Function Documentation

int _check_BGPM_error ( int  err,
char *  bgpmfunc 
)

Definition at line 27 of file linux-bgq-common.c.

00028 {
00029     char  buffer[PAPI_MAX_STR_LEN];
00030     int retval;
00031     
00032     if ( err < 0 ) {
00033         sprintf( buffer, "Error: ret value is %d for BGPM API function '%s'.",
00034                 err, bgpmfunc);
00035         retval =  _papi_hwi_publish_error( buffer );
00036         return retval;
00037     }
00038     
00039     return PAPI_OK;
00040 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _common_deleteRecreate ( int *  EventGroup_ptr  ) 

Definition at line 64 of file linux-bgq-common.c.

00065 {
00066 #ifdef DEBUG_BGQ
00067     printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
00068 #endif
00069     int retval;
00070     
00071     // delete previous bgpm eventset
00072     retval = Bgpm_DeleteEventSet( *EventGroup_ptr );
00073     retval = _check_BGPM_error( retval, "Bgpm_DeleteEventSet" );
00074     if ( retval < 0 ) return retval;
00075 
00076     // create a new empty bgpm eventset
00077     *EventGroup_ptr = Bgpm_CreateEventSet();
00078     retval = _check_BGPM_error( *EventGroup_ptr, "Bgpm_CreateEventSet" );
00079     if ( retval < 0 ) return retval;
00080 
00081 #ifdef DEBUG_BGQ
00082     printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
00083 #endif
00084     return PAPI_OK;
00085 }

Here is the call graph for this function:

Here is the caller graph for this function:

long_long _common_getEventValue ( unsigned  event_id,
int  EventGroup 
)

Definition at line 47 of file linux-bgq-common.c.

00048 {   
00049     uint64_t value;
00050     int retval;
00051     
00052     retval = Bgpm_ReadEvent( EventGroup, event_id, &value );
00053     retval = _check_BGPM_error( retval, "Bgpm_ReadEvent" );
00054     if ( retval < 0 ) return retval;
00055 
00056     return ( ( long_long ) value ); 
00057 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _common_rebuildEventgroup ( int  count,
int *  EventGroup_local,
int *  EventGroup_ptr 
)

Definition at line 92 of file linux-bgq-common.c.

00093 {
00094 #ifdef DEBUG_BGQ
00095     printf( "_common_rebuildEventgroup\n" );
00096 #endif  
00097     int i, retval;
00098     
00099     // rebuild BGPM EventGroup
00100     for ( i = 0; i < count; i++ ) {
00101         retval = Bgpm_AddEvent( *EventGroup_ptr, EventGroup_local[i] );
00102         retval = _check_BGPM_error( retval, "Bgpm_AddEvent" );
00103         if ( retval < 0 ) return retval;
00104 
00105 #ifdef DEBUG_BGQ
00106         printf( "_common_rebuildEventgroup: After emptying EventGroup, event re-added: %d\n",
00107                 EventGroup_local[i] );
00108 #endif
00109     }
00110     return PAPI_OK;
00111 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _common_set_overflow_BGPM ( int  EventGroup,
int  evt_idx,
int  threshold,
void(*)(int, uint64_t, uint64_t, const ucontext_t *)  handler 
)

Definition at line 121 of file linux-bgq-common.c.

00125 {
00126     int retval;
00127     uint64_t threshold_for_bgpm;
00128     
00129     /* convert threadhold value assigned by PAPI user to value that is
00130      * programmed into the counter. This value is required by Bgpm_SetOverflow() */ 
00131     threshold_for_bgpm = BGPM_PERIOD2THRES( threshold );
00132     
00133 #ifdef DEBUG_BGQ
00134     printf("_common_set_overflow_BGPM\n");
00135     
00136     int i;
00137     int numEvts = Bgpm_NumEvents( EventGroup );
00138     for ( i = 0; i < numEvts; i++ ) {
00139         printf("_common_set_overflow_BGPM: %d = %s\n", i, Bgpm_GetEventLabel( EventGroup, i) );
00140     }
00141 #endif  
00142     
00143     
00144     retval = Bgpm_SetOverflow( EventGroup, 
00145                                evt_idx,
00146                                threshold_for_bgpm );
00147     retval = _check_BGPM_error( retval, "Bgpm_SetOverflow" );
00148     if ( retval < 0 ) return retval;
00149 
00150     retval = Bgpm_SetEventUser1( EventGroup, 
00151                                  evt_idx,
00152                                  1024 );
00153     retval = _check_BGPM_error( retval, "Bgpm_SetEventUser1" );
00154     if ( retval < 0 ) return retval;
00155 
00156     /* user signal handler for overflow case */
00157     retval = Bgpm_SetOverflowHandler( EventGroup, 
00158                                       handler );
00159     retval = _check_BGPM_error( retval, "Bgpm_SetOverflowHandler" );    
00160     if ( retval < 0 ) return retval;
00161 
00162     return PAPI_OK;
00163 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_publish_error ( char *  error  ) 

Definition at line 466 of file papi_internal.c.

00467 {
00468     int error_code = -1;
00469 
00470     if ( (error_code = _papi_hwi_lookup_error( error )) < 0 )
00471         error_code = _papi_hwi_add_error(error);
00472 
00473     return (-error_code); /* internally error_code is an index, externally, it should be <= 0 */
00474 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1