PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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.

34  {
35 
36  switch ( pfm_error ) {
37  case PFM_SUCCESS: return PAPI_OK; /* success */
38  case PFM_ERR_NOTSUPP: return PAPI_ENOSUPP; /* function not supported */
39  case PFM_ERR_INVAL: return PAPI_EINVAL; /* invalid parameters */
40  case PFM_ERR_NOINIT: return PAPI_ENOINIT; /* library not initialized */
41  case PFM_ERR_NOTFOUND: return PAPI_ENOEVNT; /* event not found */
42  case PFM_ERR_FEATCOMB: return PAPI_ECOMBO; /* invalid combination of features */
43  case PFM_ERR_UMASK: return PAPI_EATTR; /* invalid or missing unit mask */
44  case PFM_ERR_NOMEM: return PAPI_ENOMEM; /* out of memory */
45  case PFM_ERR_ATTR: return PAPI_EATTR; /* invalid event attribute */
46  case PFM_ERR_ATTR_VAL: return PAPI_EATTR; /* invalid event attribute value */
47  case PFM_ERR_ATTR_SET: return PAPI_EATTR; /* attribute value already set */
48  case PFM_ERR_TOOMANY: return PAPI_ECOUNT; /* too many parameters */
49  case PFM_ERR_TOOSMALL: return PAPI_ECOUNT; /* parameter is too small */
50  default: return PAPI_EINVAL;
51  }
52 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_ENOSUPP
Definition: papi.h:269
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_EATTR
Definition: papi.h:273
#define PAPI_ENOMEM
Definition: papi.h:252
#define PAPI_ENOINIT
Definition: papi.h:267
#define PAPI_ECOMBO
Definition: papi.h:275
#define PAPI_ECOUNT
Definition: papi.h:274

Here is the caller graph for this function:

Definition at line 97 of file papi_libpfm4_events.c.

97  {
98 
99  int version;
100  pfm_err_t retval = PFM_SUCCESS;
101 
103 
104  if (!libpfm4_users) {
105  retval = pfm_initialize();
106  if ( retval != PFM_SUCCESS ) libpfm4_users--;
107  }
108  libpfm4_users++;
109 
111 
112  if ( retval != PFM_SUCCESS ) {
113  PAPIERROR( "pfm_initialize(): %s", pfm_strerror( retval ) );
114  return PAPI_ESYS;
115  }
116 
117  /* get the libpfm4 version */
118  SUBDBG( "pfm_get_version()\n");
119  if ( (version=pfm_get_version( )) < 0 ) {
120  PAPIERROR( "pfm_get_version(): %s", pfm_strerror( retval ) );
121  return PAPI_ESYS;
122  }
123 
124  /* Set the version */
125  sprintf( my_vector->cmp_info.support_version, "%d.%d",
126  PFM_MAJ_VERSION( version ), PFM_MIN_VERSION( version ) );
127 
128  /* Complain if the compiled-against version doesn't match current version */
129  if ( PFM_MAJ_VERSION( version ) != PFM_MAJ_VERSION( LIBPFM_VERSION ) ) {
130  PAPIERROR( "Version mismatch of libpfm: compiled %#x vs. installed %#x\n",
131  PFM_MAJ_VERSION( LIBPFM_VERSION ),
132  PFM_MAJ_VERSION( version ) );
133  return PAPI_ESYS;
134  }
135 
136  return PAPI_OK;
137 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
static int libpfm4_users
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
#define PAPI_ESYS
Definition: papi.h:253
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)
char version[]
Definition: fileop.c:134
#define NAMELIB_LOCK
Definition: papi_internal.h:93
char support_version[PAPI_MIN_STR_LEN]
Definition: papi.h:631
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 64 of file papi_libpfm4_events.c.

64  {
65 
66 
67  APIDBG("Entry\n");
68 
69  /* clean out and free the native events structure */
71 
72  libpfm4_users--;
73 
74  /* Only free if we're the last user */
75 
76  if (!libpfm4_users) {
77  pfm_terminate();
78  }
79 
81 
82  return PAPI_OK;
83 }
return PAPI_OK
Definition: linux-nvml.c:458
static int libpfm4_users
#define APIDBG(format, args...)
Definition: papi_debug.h:64
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
#define NAMELIB_LOCK
Definition: papi_internal.h:93

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.