papi_libpfm4_events.c File Reference

Include dependency graph for papi_libpfm4_events.c:

Go to the source code of this file.

Functions

int _papi_libpfm4_error (int pfm_error)
int _papi_libpfm4_shutdown (void)
int _papi_libpfm4_init (papi_vector_t *my_vector)

Variables

static int libpfm4_users = 0

Function Documentation

int _papi_libpfm4_error ( int  pfm_error  ) 

Definition at line 34 of file papi_libpfm4_events.c.

00034                                      {
00035 
00036   switch ( pfm_error ) {
00037   case PFM_SUCCESS:      return PAPI_OK;       /* success */
00038   case PFM_ERR_NOTSUPP:  return PAPI_ENOSUPP;  /* function not supported */
00039   case PFM_ERR_INVAL:    return PAPI_EINVAL;   /* invalid parameters */
00040   case PFM_ERR_NOINIT:   return PAPI_ENOINIT;  /* library not initialized */
00041   case PFM_ERR_NOTFOUND: return PAPI_ENOEVNT;  /* event not found */
00042   case PFM_ERR_FEATCOMB: return PAPI_ECOMBO;   /* invalid combination of features */
00043   case PFM_ERR_UMASK:    return PAPI_EATTR;    /* invalid or missing unit mask */
00044   case PFM_ERR_NOMEM:    return PAPI_ENOMEM;   /* out of memory */
00045   case PFM_ERR_ATTR:     return PAPI_EATTR;    /* invalid event attribute */
00046   case PFM_ERR_ATTR_VAL: return PAPI_EATTR;    /* invalid event attribute value */
00047   case PFM_ERR_ATTR_SET: return PAPI_EATTR;    /* attribute value already set */
00048   case PFM_ERR_TOOMANY:  return PAPI_ECOUNT;   /* too many parameters */
00049   case PFM_ERR_TOOSMALL: return PAPI_ECOUNT;   /* parameter is too small */
00050   default: return PAPI_EINVAL;
00051   }
00052 }

Here is the caller graph for this function:

int _papi_libpfm4_init ( papi_vector_t my_vector  ) 

Definition at line 97 of file papi_libpfm4_events.c.

00097                                              {
00098 
00099    int version;
00100    pfm_err_t retval = PFM_SUCCESS;
00101 
00102    _papi_hwi_lock( NAMELIB_LOCK );
00103 
00104    if (!libpfm4_users) {
00105       retval = pfm_initialize();
00106       if ( retval != PFM_SUCCESS ) libpfm4_users--;
00107    }
00108    libpfm4_users++;
00109 
00110    _papi_hwi_unlock( NAMELIB_LOCK );
00111 
00112    if ( retval != PFM_SUCCESS ) {
00113       PAPIERROR( "pfm_initialize(): %s", pfm_strerror( retval ) );
00114       return PAPI_ESYS;
00115    }
00116 
00117    /* get the libpfm4 version */
00118    SUBDBG( "pfm_get_version()\n");
00119    if ( (version=pfm_get_version( )) < 0 ) {
00120       PAPIERROR( "pfm_get_version(): %s", pfm_strerror( retval ) );
00121       return PAPI_ESYS;
00122    }
00123 
00124    /* Set the version */
00125    sprintf( my_vector->cmp_info.support_version, "%d.%d",
00126         PFM_MAJ_VERSION( version ), PFM_MIN_VERSION( version ) );
00127 
00128    /* Complain if the compiled-against version doesn't match current version */
00129    if ( PFM_MAJ_VERSION( version ) != PFM_MAJ_VERSION( LIBPFM_VERSION ) ) {
00130       PAPIERROR( "Version mismatch of libpfm: compiled %#x vs. installed %#x\n",
00131                    PFM_MAJ_VERSION( LIBPFM_VERSION ),
00132                    PFM_MAJ_VERSION( version ) );
00133       return PAPI_ESYS;
00134    }
00135 
00136    return PAPI_OK;
00137 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_libpfm4_shutdown ( void   ) 

Definition at line 64 of file papi_libpfm4_events.c.

00064                              {
00065 
00066 
00067   SUBDBG("Entry\n");
00068 
00069   /* clean out and free the native events structure */
00070   _papi_hwi_lock( NAMELIB_LOCK );
00071 
00072   libpfm4_users--;
00073 
00074   /* Only free if we're the last user */
00075 
00076   if (!libpfm4_users) {
00077      pfm_terminate();
00078   }
00079 
00080   _papi_hwi_unlock( NAMELIB_LOCK );
00081 
00082   return PAPI_OK;
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int libpfm4_users = 0 [static]

Definition at line 54 of file papi_libpfm4_events.c.


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1