PAPI  5.3.0.0
papi_libpfm4_events.h File Reference
Include dependency graph for papi_libpfm4_events.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  native_event_t
struct  native_event_table_t

Defines

#define PMU_TYPE_CORE   1
#define PMU_TYPE_UNCORE   2
#define PMU_TYPE_OS   4

Functions

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

Define Documentation

#define PMU_TYPE_CORE   1

Definition at line 25 of file papi_libpfm4_events.h.

#define PMU_TYPE_OS   4

Definition at line 27 of file papi_libpfm4_events.h.

#define PMU_TYPE_UNCORE   2

Definition at line 26 of file papi_libpfm4_events.h.


Function Documentation

int _papi_libpfm4_error ( int  pfm_error)

Definition at line 34 of file papi_libpfm4_events.c.

                                     {

  switch ( pfm_error ) {
  case PFM_SUCCESS:      return PAPI_OK;       /* success */
  case PFM_ERR_NOTSUPP:  return PAPI_ENOSUPP;  /* function not supported */
  case PFM_ERR_INVAL:    return PAPI_EINVAL;   /* invalid parameters */
  case PFM_ERR_NOINIT:   return PAPI_ENOINIT;  /* library not initialized */
  case PFM_ERR_NOTFOUND: return PAPI_ENOEVNT;  /* event not found */
  case PFM_ERR_FEATCOMB: return PAPI_ECOMBO;   /* invalid combination of features */
  case PFM_ERR_UMASK:    return PAPI_EATTR;    /* invalid or missing unit mask */
  case PFM_ERR_NOMEM:    return PAPI_ENOMEM;   /* out of memory */
  case PFM_ERR_ATTR:     return PAPI_EATTR;    /* invalid event attribute */
  case PFM_ERR_ATTR_VAL: return PAPI_EATTR;    /* invalid event attribute value */
  case PFM_ERR_ATTR_SET: return PAPI_EATTR;    /* attribute value already set */
  case PFM_ERR_TOOMANY:  return PAPI_ECOUNT;   /* too many parameters */
  case PFM_ERR_TOOSMALL: return PAPI_ECOUNT;   /* parameter is too small */
  default: return PAPI_EINVAL;
  }
}

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.

                                             {

   int version;
   pfm_err_t retval = PFM_SUCCESS;

   _papi_hwi_lock( NAMELIB_LOCK );

   if (!libpfm4_users) {
      retval = pfm_initialize();
      if ( retval != PFM_SUCCESS ) libpfm4_users--;
   }
   libpfm4_users++;

   _papi_hwi_unlock( NAMELIB_LOCK );

   if ( retval != PFM_SUCCESS ) {
      PAPIERROR( "pfm_initialize(): %s", pfm_strerror( retval ) );
      return PAPI_ESYS;
   }

   /* get the libpfm4 version */
   SUBDBG( "pfm_get_version()\n");
   if ( (version=pfm_get_version( )) < 0 ) {
      PAPIERROR( "pfm_get_version(): %s", pfm_strerror( retval ) );
      return PAPI_ESYS;
   }

   /* Set the version */
   sprintf( my_vector->cmp_info.support_version, "%d.%d",
        PFM_MAJ_VERSION( version ), PFM_MIN_VERSION( version ) );

   /* Complain if the compiled-against version doesn't match current version */
   if ( PFM_MAJ_VERSION( version ) != PFM_MAJ_VERSION( LIBPFM_VERSION ) ) {
      PAPIERROR( "Version mismatch of libpfm: compiled %#x vs. installed %#x\n",
                   PFM_MAJ_VERSION( LIBPFM_VERSION ),
                   PFM_MAJ_VERSION( version ) );
      return PAPI_ESYS;
   }

   return PAPI_OK;
}

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.

                             {


  APIDBG("Entry\n");

  /* clean out and free the native events structure */
  _papi_hwi_lock( NAMELIB_LOCK );

  libpfm4_users--;

  /* Only free if we're the last user */

  if (!libpfm4_users) {
     pfm_terminate();
  }

  _papi_hwi_unlock( NAMELIB_LOCK );

  return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines