PAPI  5.6.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 (papi_vector_t *my_vector)
 
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 39 of file papi_libpfm4_events.c.

39  {
40 
41  switch ( pfm_error ) {
42  case PFM_SUCCESS: return PAPI_OK; /* success */
43  case PFM_ERR_NOTSUPP: return PAPI_ENOSUPP; /* function not supported */
44  case PFM_ERR_INVAL: return PAPI_EINVAL; /* invalid parameters */
45  case PFM_ERR_NOINIT: return PAPI_ENOINIT; /* library not initialized */
46  case PFM_ERR_NOTFOUND: return PAPI_ENOEVNT; /* event not found */
47  case PFM_ERR_FEATCOMB: return PAPI_ECOMBO; /* invalid combination of features */
48  case PFM_ERR_UMASK: return PAPI_EATTR; /* invalid or missing unit mask */
49  case PFM_ERR_NOMEM: return PAPI_ENOMEM; /* out of memory */
50  case PFM_ERR_ATTR: return PAPI_EATTR; /* invalid event attribute */
51  case PFM_ERR_ATTR_VAL: return PAPI_EATTR; /* invalid event attribute value */
52  case PFM_ERR_ATTR_SET: return PAPI_EATTR; /* attribute value already set */
53  case PFM_ERR_TOOMANY: return PAPI_ECOUNT; /* too many parameters */
54  case PFM_ERR_TOOSMALL: return PAPI_ECOUNT; /* parameter is too small */
55  default:
56  PAPIWARN("Unknown libpfm error code %d, returning PAPI_EINVAL",pfm_error);
57  return PAPI_EINVAL;
58  }
59 }
#define PAPI_ENOEVNT
Definition: papi.h:260
void PAPIWARN(char *format,...)
#define PAPI_ENOSUPP
Definition: papi.h:271
return PAPI_OK
Definition: linux-nvml.c:497
return PAPI_EINVAL
Definition: linux-nvml.c:436
#define PAPI_EATTR
Definition: papi.h:275
#define PAPI_ENOMEM
Definition: papi.h:254
#define PAPI_ENOINIT
Definition: papi.h:269
#define PAPI_ECOMBO
Definition: papi.h:277
#define PAPI_ECOUNT
Definition: papi.h:276

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 104 of file papi_libpfm4_events.c.

104  {
105 
106  int version;
107  pfm_err_t retval = PFM_SUCCESS;
108 
110 
111  if (!libpfm4_users) {
112  retval = pfm_initialize();
113  if ( retval == PFM_SUCCESS ) {
114  libpfm4_users++;
115  }
116  else {
117  strncpy(my_vector->cmp_info.disabled_reason,
118  pfm_strerror(retval),PAPI_MAX_STR_LEN);
120  return PAPI_ESBSTR;
121  }
122  }
123  else {
124  libpfm4_users++;
125  }
126 
128 
129  /* get the libpfm4 version */
130 
131  version=pfm_get_version( );
132  if (version >= 0) {
133 
134  /* Complain if the compiled-against version */
135  /* doesn't match current version */
136 
137  if ( PFM_MAJ_VERSION( version ) !=
138  PFM_MAJ_VERSION( LIBPFM_VERSION ) ) {
139 
140  PAPIWARN( "Version mismatch of libpfm: "
141  "compiled %#x vs. installed %#x\n",
142  PFM_MAJ_VERSION( LIBPFM_VERSION ),
143  PFM_MAJ_VERSION( version ) );
144 
145  }
146 
147  /* Set the version */
148  sprintf( my_vector->cmp_info.support_version, "%d.%d",
149  PFM_MAJ_VERSION( version ),
150  PFM_MIN_VERSION( version ) );
151 
152  } else {
153  PAPIWARN( "pfm_get_version(): %s", pfm_strerror( retval ) );
154  }
155 
156  return PAPI_OK;
157 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
void PAPIWARN(char *format,...)
return PAPI_OK
Definition: linux-nvml.c:497
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
static int libpfm4_users
char disabled_reason[PAPI_MAX_STR_LEN]
Definition: papi.h:636
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
char version[]
Definition: fileop.c:134
#define NAMELIB_LOCK
Definition: papi_internal.h:94
char support_version[PAPI_MIN_STR_LEN]
Definition: papi.h:634
#define PAPI_MAX_STR_LEN
Definition: papi.h:465
ssize_t retval
Definition: libasync.c:338
#define PAPI_ESBSTR
Definition: papi.h:257

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 72 of file papi_libpfm4_events.c.

72  {
73 
74  /* clean out and free the native events structure */
76 
77  libpfm4_users--;
78 
79  /* Only free if we're the last user */
80 
81  if (!libpfm4_users) {
82  pfm_terminate();
83  }
84 
86 
87  strcpy(my_vector->cmp_info.support_version,"");
88 
89  return PAPI_OK;
90 }
return PAPI_OK
Definition: linux-nvml.c:497
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
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
#define NAMELIB_LOCK
Definition: papi_internal.h:94
strcpy(filename, default_filename)
char support_version[PAPI_MIN_STR_LEN]
Definition: papi.h:634

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 22 of file papi_libpfm4_events.c.