PAPI  5.3.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pe_libpfm4_events.c File Reference
Include dependency graph for pe_libpfm4_events.c:

Go to the source code of this file.

Macros

#define NATIVE_EVENT_CHUNK   1024
 

Functions

static int find_existing_event (char *name, struct native_event_table_t *event_table)
 
static struct native_event_tfind_existing_event_by_number (int eventnum, struct native_event_table_t *event_table)
 
static int pmu_is_present_and_right_type (pfm_pmu_info_t *pinfo, int type)
 
static int find_event (char *name, int pmu_type)
 
static int find_event_no_aliases (char *name, int pmu_type)
 
static int find_next_no_aliases (int code, int pmu_type)
 
static struct native_event_tallocate_native_event (char *name, int event_idx, struct native_event_table_t *event_table)
 
static int find_max_umask (struct native_event_t *current_event)
 
static int get_event_first_active (int pmu_type)
 
static int convert_libpfm4_to_string (int code, char **event_name, pfm_pmu_info_t *default_pmu)
 
static int convert_pfmidx_to_native (int code, unsigned int *PapiEventCode, struct native_event_table_t *event_table)
 
static int find_next_umask (struct native_event_t *current_event, int current, char *umask_name)
 
int _pe_libpfm4_ntv_name_to_code (char *name, unsigned int *event_code, struct native_event_table_t *event_table)
 
int _pe_libpfm4_ntv_code_to_name (unsigned int EventCode, char *ntv_name, int len, struct native_event_table_t *event_table)
 
int _pe_libpfm4_ntv_code_to_descr (unsigned int EventCode, char *ntv_descr, int len, struct native_event_table_t *event_table)
 
int _pe_libpfm4_ntv_code_to_info (unsigned int EventCode, PAPI_event_info_t *info, struct native_event_table_t *event_table)
 
int _pe_libpfm4_ntv_enum_events (unsigned int *PapiEventCode, int modifier, struct native_event_table_t *event_table)
 
int _pe_libpfm4_shutdown (struct native_event_table_t *event_table)
 
int _pe_libpfm4_init (papi_vector_t *my_vector, int cidx, struct native_event_table_t *event_table, int pmu_type)
 
int _pe_libpfm4_setup_counters (struct perf_event_attr *attr, int event, struct native_event_table_t *event_table)
 

Macro Definition Documentation

#define NATIVE_EVENT_CHUNK   1024

Definition at line 18 of file pe_libpfm4_events.c.

Function Documentation

int _pe_libpfm4_init ( papi_vector_t my_vector,
int  cidx,
struct native_event_table_t event_table,
int  pmu_type 
)

Definition at line 1343 of file pe_libpfm4_events.c.

1345  {
1346 
1347  int detected_pmus=0, found_default=0;
1348  int i;
1349  pfm_err_t retval = PFM_SUCCESS;
1350  unsigned int ncnt;
1351  pfm_pmu_info_t pinfo;
1352 
1353  /* allocate the native event structure */
1354 
1355  event_table->num_native_events=0;
1356  event_table->pmu_type=pmu_type;
1357 
1358  event_table->native_events=calloc(NATIVE_EVENT_CHUNK,
1359  sizeof(struct native_event_t));
1360  if (event_table->native_events==NULL) {
1361  return PAPI_ENOMEM;
1362  }
1364 
1365  /* Count number of present PMUs */
1366  detected_pmus=0;
1367  ncnt=0;
1368 
1369  /* need to init pinfo or pfmlib might complain */
1370  memset(&(event_table->default_pmu), 0, sizeof(pfm_pmu_info_t));
1371  /* init default pmu */
1372  retval=pfm_get_pmu_info(0, &(event_table->default_pmu));
1373 
1374  SUBDBG("Detected pmus:\n");
1375  for(i=0;i<PFM_PMU_MAX;i++) {
1376  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
1377  retval=pfm_get_pmu_info(i, &pinfo);
1378  if (retval!=PFM_SUCCESS) {
1379  continue;
1380  }
1381 
1382  if (pmu_is_present_and_right_type(&pinfo,pmu_type)) {
1383  SUBDBG("\t%d %s %s %d\n",i,pinfo.name,pinfo.desc,pinfo.type);
1384 
1385  detected_pmus++;
1386  ncnt+=pinfo.nevents;
1387 
1388  if (pmu_type&PMU_TYPE_CORE) {
1389 
1390  /* Hack to have "default" PMU */
1391  if ( (pinfo.type==PFM_PMU_TYPE_CORE) &&
1392  strcmp(pinfo.name,"ix86arch")) {
1393 
1394  SUBDBG("\t %s is default\n",pinfo.name);
1395  memcpy(&(event_table->default_pmu),
1396  &pinfo,sizeof(pfm_pmu_info_t));
1397  found_default++;
1398  }
1399  }
1400  if (pmu_type==PMU_TYPE_UNCORE) {
1401  /* To avoid confusion, no "default" CPU for uncore */
1402  found_default=1;
1403  }
1404  }
1405  }
1406  SUBDBG("%d native events detected on %d pmus\n",ncnt,detected_pmus);
1407 
1408  if (!found_default) {
1409  SUBDBG("Could not find default PMU\n");
1410  return PAPI_ECMP;
1411  }
1412 
1413  if (found_default>1) {
1414  PAPIERROR("Found too many default PMUs!\n");
1415  return PAPI_ECMP;
1416  }
1417 
1418  my_vector->cmp_info.num_native_events = ncnt;
1419 
1420  my_vector->cmp_info.num_cntrs = event_table->default_pmu.num_cntrs+
1421  event_table->default_pmu.num_fixed_cntrs;
1422 
1423  SUBDBG( "num_counters: %d\n", my_vector->cmp_info.num_cntrs );
1424 
1425  /* Setup presets, only if Component 0 */
1426  if (cidx==0) {
1427  retval = _papi_load_preset_table( (char *)event_table->default_pmu.name,
1428  event_table->default_pmu.pmu, cidx );
1429  if ( retval ) {
1430  return retval;
1431  }
1432  }
1433 
1434  return PAPI_OK;
1435 }
memset(eventId, 0, size)
#define PAPI_ENOMEM
Definition: fpapi.h:107
struct native_event_t * native_events
#define NATIVE_EVENT_CHUNK
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int i
Definition: fileop.c:140
static int cidx
Definition: event_info.c:40
#define PAPI_ECMP
Definition: fpapi.h:109
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)
#define PMU_TYPE_CORE
int _papi_load_preset_table(char *pmu_str, int pmu_type, int cidx)
Definition: papi_preset.c:299
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)
#define PMU_TYPE_UNCORE
pfm_pmu_info_t default_pmu
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_ntv_code_to_descr ( unsigned int  EventCode,
char *  ntv_descr,
int  len,
struct native_event_table_t event_table 
)

Definition at line 902 of file pe_libpfm4_events.c.

905 {
906  int ret,a,first_mask=1;
907  char *eventd, *tmp=NULL;
908  pfm_event_info_t gete;
909 
910  pfm_event_attr_info_t ainfo;
911  char *b;
912  char event_string[BUFSIZ],*ptr;
913  char temp_string[BUFSIZ];
914 
915  struct native_event_t *our_event;
916 
917  SUBDBG("ENTER %#x\n",EventCode);
918 
919  our_event=find_existing_event_by_number(EventCode,event_table);
920  if (our_event==NULL) {
921  return PAPI_ENOEVNT;
922  }
923 
924  SUBDBG("Getting info on %#x\n",our_event->libpfm4_idx);
925 
926  /* libpfm requires the structure be zeroed */
927  memset( &gete, 0, sizeof ( gete ) );
928 
929  ret=pfm_get_event_info(our_event->libpfm4_idx, PFM_OS_PERF_EVENT, &gete);
930  if (ret<0) {
931  SUBDBG("Return=%d\n",ret);
932  return _papi_libpfm4_error(ret);
933  }
934 
935  eventd=strdup(gete.desc);
936 
937  tmp = ( char * ) malloc( strlen( eventd ) + 1 );
938  if ( tmp == NULL ) {
939  free( eventd );
940  return PAPI_ENOMEM;
941  }
942 
943  tmp[0] = '\0';
944  strcat( tmp, eventd );
945  free( eventd );
946 
947  /* Handle Umasks */
948 
949  /* attributes concactinated onto end of descr separated by ", masks" */
950  /* then comma separated */
951 
952  strcpy(event_string,our_event->allocated_name);
953 
954  /* Point to first umask */
955 
956  /* Skip the pmu name :: if one exists */
957  if (strstr(event_string,"::")) {
958  ptr=strstr(event_string,"::");
959  ptr+=2;
960  b=strtok(ptr,":");
961  }
962  else {
963  b=strtok(event_string,":");
964  }
965 
966  /* if no umask, then done */
967  if (!b) {
968  SUBDBG("No colon!\n"); /* no umask */
969  goto descr_in_tmp;
970  }
971 
972  /* skip first */
973  b=strtok(NULL,":");
974  if (!b) {
975  SUBDBG("Skipping first failed\n");
976  goto descr_in_tmp;
977  }
978 
979  /* loop through all umasks, seeing which match */
980  while(b) {
981  a=0;
982  while(1) {
983 
984  SUBDBG("get_event_attr %#x %p\n",our_event->libpfm4_idx,&ainfo);
985 
986  memset(&ainfo,0,sizeof(pfm_event_attr_info_t));
987 
988  ret = pfm_get_event_attr_info(our_event->libpfm4_idx, a,
989  PFM_OS_PERF_EVENT, &ainfo);
990  if (ret != PFM_SUCCESS) {
991  free( tmp );
992  SUBDBG("get_event_attr failed %s\n",pfm_strerror(ret));
993  return _papi_libpfm4_error(ret);
994  }
995 
996  /* Plain UMASK case */
997  if (ainfo.type == PFM_ATTR_UMASK) {
998 
999  SUBDBG("Trying %s with %s\n",ainfo.name,b);
1000 
1001  if (!strcasecmp(ainfo.name, b)) {
1002  int new_length;
1003 
1004  SUBDBG("Found %s\n",b);
1005  new_length=strlen(ainfo.desc);
1006 
1007  if (first_mask) {
1008  tmp=realloc(tmp,strlen(tmp)+new_length+1+strlen(", masks:"));
1009  strcat(tmp,", masks:");
1010  first_mask=0;
1011  }
1012  else {
1013  tmp=realloc(tmp,strlen(tmp)+new_length+1+strlen(","));
1014  strcat(tmp,",");
1015  }
1016  strcat(tmp,ainfo.desc);
1017 
1018  goto found_attr;
1019  }
1020  }
1021 
1022  /* Boolean Case */
1023  if (ainfo.type == PFM_ATTR_MOD_BOOL) {
1024 
1025  sprintf(temp_string,"%s=0",ainfo.name);
1026 
1027  SUBDBG("Trying %s with %s\n",temp_string,b);
1028 
1029  if (!strcasecmp(temp_string, b)) {
1030  int new_length;
1031 
1032  SUBDBG("Found %s\n",b);
1033  new_length=strlen(ainfo.desc);
1034 
1035  if (first_mask) {
1036  tmp=realloc(tmp,strlen(tmp)+new_length+1+strlen(", masks:"));
1037  strcat(tmp,", masks:");
1038  first_mask=0;
1039  }
1040  else {
1041  tmp=realloc(tmp,strlen(tmp)+new_length+1+strlen(","));
1042  strcat(tmp,",");
1043  }
1044  strcat(tmp,ainfo.desc);
1045 
1046  goto found_attr;
1047  }
1048  }
1049 
1050  /* Integer Case */
1051  if (ainfo.type == PFM_ATTR_MOD_INTEGER) {
1052 
1053  sprintf(temp_string,"%s=0",ainfo.name);
1054 
1055  SUBDBG("Trying %s with %s\n",temp_string,b);
1056 
1057  if (!strcasecmp(temp_string, b)) {
1058  int new_length;
1059 
1060  SUBDBG("Found %s\n",b);
1061  new_length=strlen(ainfo.desc);
1062 
1063  if (first_mask) {
1064  tmp=realloc(tmp,strlen(tmp)+new_length+1+strlen(", masks:"));
1065  strcat(tmp,", masks:");
1066  first_mask=0;
1067  }
1068  else {
1069  tmp=realloc(tmp,strlen(tmp)+new_length+1+strlen(","));
1070  strcat(tmp,",");
1071  }
1072  strcat(tmp,ainfo.desc);
1073 
1074  goto found_attr;
1075  }
1076  }
1077 
1078  a++;
1079  }
1080 
1081  SUBDBG("attr=%s not found for event %s\n", b, ainfo.name);
1082 
1083  return PAPI_EATTR;
1084 
1085 found_attr:
1086 
1087  b=strtok(NULL,":");
1088  }
1089 
1090  /* We are done and the description to copy is in tmp */
1091 descr_in_tmp:
1092  strncpy( ntv_descr, tmp, ( size_t ) len );
1093  if ( ( int ) strlen( tmp ) > len - 1 )
1094  ret = PAPI_EBUF;
1095  else
1096  ret = PAPI_OK;
1097  free( tmp );
1098 
1099  SUBDBG("PFM4 Code: %#x %s\n",EventCode,ntv_descr);
1100 
1101  return ret;
1102 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
#define PAPI_ENOMEM
Definition: fpapi.h:107
#define PAPI_ENOEVNT
Definition: fpapi.h:112
#define PAPI_EATTR
Definition: fpapi.h:127
return PAPI_OK
Definition: linux-nvml.c:458
int _papi_libpfm4_error(int pfm_error)
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
long long ret
Definition: iozone.c:1346
static struct native_event_t * find_existing_event_by_number(int eventnum, struct native_event_table_t *event_table)
free(dummyfile[xx])
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
strcat(command, mountname)
strcpy(filename, default_filename)
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
#define PAPI_EBUF
Definition: fpapi.h:125
long long tmp
Definition: iozone.c:12031
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_ntv_code_to_info ( unsigned int  EventCode,
PAPI_event_info_t info,
struct native_event_table_t event_table 
)

Definition at line 1106 of file pe_libpfm4_events.c.

1109 {
1110 
1111 
1112  struct native_event_t *our_event;
1113 
1114  SUBDBG("ENTER %#x\n",EventCode);
1115 
1116  our_event=find_existing_event_by_number(EventCode,event_table);
1117  if (our_event==NULL) {
1118  return PAPI_ENOEVNT;
1119  }
1120 
1121  strncpy(info->symbol, our_event->allocated_name, sizeof(info->symbol));
1122 
1123  if (strlen(our_event->allocated_name) > sizeof(info->symbol)) {
1124  return PAPI_EBUF;
1125  }
1126 
1127  _pe_libpfm4_ntv_code_to_descr(EventCode,info->long_descr,
1128  sizeof(info->long_descr),event_table);
1129 
1130  return PAPI_OK;
1131 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:964
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:961
return PAPI_OK
Definition: linux-nvml.c:458
static struct native_event_t * find_existing_event_by_number(int eventnum, struct native_event_table_t *event_table)
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _pe_libpfm4_ntv_code_to_descr(unsigned int EventCode, char *ntv_descr, int len, struct native_event_table_t *event_table)
#define PAPI_EBUF
Definition: fpapi.h:125

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_ntv_code_to_name ( unsigned int  EventCode,
char *  ntv_name,
int  len,
struct native_event_table_t event_table 
)

Definition at line 855 of file pe_libpfm4_events.c.

858 {
859 
860  struct native_event_t *our_event;
861 
862  SUBDBG("ENTER %#x\n",EventCode);
863 
864  our_event=find_existing_event_by_number(EventCode,event_table);
865  if (our_event==NULL) {
866  return PAPI_ENOEVNT;
867  }
868 
869  strncpy(ntv_name,our_event->allocated_name,len);
870 
871  if (strlen(our_event->allocated_name) > (unsigned)len) {
872  return PAPI_EBUF;
873  }
874 
875  return PAPI_OK;
876 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
static struct native_event_t * find_existing_event_by_number(int eventnum, struct native_event_table_t *event_table)
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define PAPI_EBUF
Definition: fpapi.h:125

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_ntv_enum_events ( unsigned int PapiEventCode,
int  modifier,
struct native_event_table_t event_table 
)

Definition at line 1152 of file pe_libpfm4_events.c.

1154  {
1155 
1156  int code,ret;
1157  struct native_event_t *current_event;
1158 
1159  SUBDBG("ENTER\n");
1160 
1161  /* return first event if so specified */
1162  if ( modifier == PAPI_ENUM_FIRST ) {
1163 
1164  unsigned int papi_event=0;
1165 
1166  SUBDBG("ENUM_FIRST\n");
1167 
1168  code=get_event_first_active(event_table->pmu_type);
1169  SUBDBG("ENUM_FIRST code: %d\n",code);
1170  if (code < 0 ) {
1171  return code;
1172  }
1173 
1174  /* convert the libpfm4 event to a PAPI event */
1175  ret=convert_pfmidx_to_native(code, &papi_event,event_table);
1176 
1177  *PapiEventCode=(unsigned int)papi_event;
1178 
1179  SUBDBG("FOUND %#x (from %#x) ret=%d\n",*PapiEventCode,code,ret);
1180 
1181  return ret;
1182  }
1183 
1184  /* If we get this far, we're looking for a */
1185  /* next-event. So gather info on the current one */
1186  current_event=find_existing_event_by_number(*PapiEventCode,
1187  event_table);
1188  if (current_event==NULL) {
1189  SUBDBG("EVENTS %#x not found\n",*PapiEventCode);
1190  return PAPI_ENOEVNT;
1191  }
1192 
1193 
1194  /* Handle looking for the next event */
1195 
1196  if ( modifier == PAPI_ENUM_EVENTS ) {
1197 
1198  unsigned int papi_event=0;
1199 
1200  SUBDBG("PAPI_ENUM_EVENTS %#x\n",*PapiEventCode);
1201 
1202  code=current_event->libpfm4_idx;
1203 
1204  ret=find_next_no_aliases(code,event_table->pmu_type);
1205  SUBDBG("find_next_no_aliases() Returned %#x\n",ret);
1206  if (ret<0) {
1207  return ret;
1208  }
1209 
1210  /* Convert libpfm4 event code to PAPI event code */
1211  ret=convert_pfmidx_to_native(ret, &papi_event, event_table);
1212  if (ret<0) {
1213  SUBDBG("Couldn't convert to native %d %s\n",
1214  ret,PAPI_strerror(ret));
1215  return ret;
1216  }
1217 
1218  *PapiEventCode=(unsigned int)papi_event;
1219 
1220  SUBDBG("Returning PAPI_OK\n");
1221 
1222  return ret;
1223  }
1224 
1225  /* We don't handle PAPI_NTV_ENUM_UMASK_COMBOS */
1226  if ( modifier == PAPI_NTV_ENUM_UMASK_COMBOS ) {
1227  return PAPI_ENOIMPL;
1228  }
1229 
1230  /* Enumerate PAPI_NTV_ENUM_UMASKS (umasks on an event) */
1231  if ( modifier == PAPI_NTV_ENUM_UMASKS ) {
1232 
1233  int max_umask,next_umask;
1234  char umask_string[BUFSIZ],new_name[BUFSIZ];
1235 
1236  SUBDBG("Finding maximum mask in event %s\n",
1237  current_event->allocated_name);
1238 
1239  max_umask=find_max_umask(current_event);
1240  SUBDBG("Found max %d\n",max_umask);
1241 
1242  if (max_umask<0) {
1243  if (max_umask==PFM_ERR_UMASK) {
1244  max_umask=-1; /* needed for find_next_umask() to work */
1245  /* indicates the event as passed had no */
1246  /* umask in it. */
1247  }
1248  else {
1249  return _papi_libpfm4_error(max_umask);
1250  }
1251  }
1252 
1253  next_umask=find_next_umask(current_event,max_umask,
1254  umask_string);
1255 
1256  SUBDBG("Found next %d\n",next_umask);
1257 
1258  if (next_umask>=0) {
1259 
1260  unsigned int papi_event;
1261 
1262  sprintf(new_name,"%s:%s",current_event->base_name,
1263  umask_string);
1264 
1265  SUBDBG("Found new name %s\n",new_name);
1266 
1267  ret=_pe_libpfm4_ntv_name_to_code(new_name,&papi_event,
1268  event_table);
1269  if (ret!=PAPI_OK) {
1270  return PAPI_ENOEVNT;
1271  }
1272 
1273  *PapiEventCode=(unsigned int)papi_event;
1274  SUBDBG("found code %#x\n",*PapiEventCode);
1275 
1276  return PAPI_OK;
1277  }
1278 
1279  SUBDBG("couldn't find umask\n");
1280 
1281  return _papi_libpfm4_error(next_umask);
1282 
1283  }
1284 
1285  /* An unknown enumeration method was indicated */
1286 
1287  return PAPI_ENOIMPL;
1288 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
#define PAPI_ENOIMPL
Definition: fpapi.h:124
static int find_next_no_aliases(int code, int pmu_type)
int _pe_libpfm4_ntv_name_to_code(char *name, unsigned int *event_code, struct native_event_table_t *event_table)
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
int _papi_libpfm4_error(int pfm_error)
long long ret
Definition: iozone.c:1346
static int get_event_first_active(int pmu_type)
static struct native_event_t * find_existing_event_by_number(int eventnum, struct native_event_table_t *event_table)
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int find_max_umask(struct native_event_t *current_event)
char * PAPI_strerror(int errorCode)
Definition: papi.c:4470
static int convert_pfmidx_to_native(int code, unsigned int *PapiEventCode, struct native_event_table_t *event_table)
int
Definition: iozone.c:18528
static int find_next_umask(struct native_event_t *current_event, int current, char *umask_name)

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_ntv_name_to_code ( char *  name,
unsigned int event_code,
struct native_event_table_t event_table 
)

Definition at line 788 of file pe_libpfm4_events.c.

790 {
791 
792  int actual_idx;
793  struct native_event_t *our_event;
794  int event_num;
795 
796  SUBDBG( "Converting %s\n", name);
797 
798  event_num=find_existing_event(name,event_table);
799 
800  if (event_num<0) {
801 
802  /* event currently doesn't exist, so try to find it */
803  /* using libpfm4 */
804 
805  SUBDBG("Using pfm to look up event %s\n",name);
806 
807  actual_idx=find_event(name, event_table->pmu_type);
808  if (actual_idx<0) {
809  return _papi_libpfm4_error(actual_idx);
810  }
811 
812  SUBDBG("Using %#x as the index\n",actual_idx);
813 
814  /* We were found in libpfm4, so allocate our copy of the event */
815 
816  our_event=allocate_native_event(name,actual_idx,event_table);
817  if (our_event==NULL) return PAPI_ENOEVNT;
818 
819  event_num=find_existing_event(name,event_table);
820  }
821 
822  if (event_num>=0) {
823  *event_code=event_num;
824  SUBDBG("Found code: %#x\n",*event_code);
825  return PAPI_OK;
826  }
827 
828  /* Failure here means allocate_native_event failed */
829 
830  SUBDBG("Event %s not found\n",name);
831 
832  return PAPI_ENOEVNT;
833 
834 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
int _papi_libpfm4_error(int pfm_error)
static int find_existing_event(char *name, struct native_event_table_t *event_table)
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static struct native_event_t * allocate_native_event(char *name, int event_idx, struct native_event_table_t *event_table)
static int find_event(char *name, int pmu_type)
char * name
Definition: iozone.c:23648

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_setup_counters ( struct perf_event_attr attr,
int  event,
struct native_event_table_t event_table 
)

Definition at line 1453 of file pe_libpfm4_events.c.

1455  {
1456 
1457  struct native_event_t *our_event;
1458 
1459  our_event=find_existing_event_by_number(event,event_table);
1460  if (our_event==NULL) {
1461  return PAPI_ENOEVNT;
1462  }
1463 
1464  attr->config=our_event->config;
1465  attr->config1=our_event->config1;
1466  attr->config2=our_event->config2;
1467  attr->type=our_event->type;
1468 
1469  SUBDBG( "pe_event: config 0x%"PRIx64
1470  " config1 0x%"PRIx64
1471  " type 0x%"PRIx32"\n",
1472  attr->config,
1473  attr->config1,
1474  attr->type);
1475 
1476 
1477  return PAPI_OK;
1478 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
return PAPI_OK
Definition: linux-nvml.c:458
static struct native_event_t * find_existing_event_by_number(int eventnum, struct native_event_table_t *event_table)
#define SUBDBG(format, args...)
Definition: papi_debug.h:63

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_libpfm4_shutdown ( struct native_event_table_t event_table)

Definition at line 1302 of file pe_libpfm4_events.c.

1302  {
1303 
1304  int i;
1305 
1306  APIDBG("Entry\n");
1307 
1308  /* clean out and free the native events structure */
1310 
1311  /* free memory allocate with strdup */
1312  for( i=0; i<event_table->num_native_events; i++) {
1313  free(event_table->native_events[i].base_name);
1314  free(event_table->native_events[i].pmu_plus_name);
1315  free(event_table->native_events[i].pmu);
1316  free(event_table->native_events[i].allocated_name);
1317  }
1318 
1319  memset(event_table->native_events,0,
1320  sizeof(struct native_event_t)*event_table->allocated_native_events);
1321  event_table->num_native_events=0;
1322  event_table->allocated_native_events=0;
1323  free(event_table->native_events);
1324 
1326 
1327  return PAPI_OK;
1328 }
memset(eventId, 0, size)
struct native_event_t * native_events
return PAPI_OK
Definition: linux-nvml.c:458
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
free(dummyfile[xx])
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:

static struct native_event_t* allocate_native_event ( char *  name,
int  event_idx,
struct native_event_table_t event_table 
)
static

Definition at line 269 of file pe_libpfm4_events.c.

271  {
272 
273  int new_event;
274 
275  pfm_err_t ret;
276  unsigned int i;
277  char *base_start;
278  pfm_event_info_t info;
279  pfm_pmu_info_t pinfo;
280  char base[BUFSIZ],pmuplusbase[BUFSIZ];
281  char fullname[BUFSIZ];
282 
283  pfm_perf_encode_arg_t perf_arg;
284 
285  struct perf_event_attr perf_attr;
286 
287  /* get the event name from libpfm */
288  memset(&info,0,sizeof(pfm_event_info_t));
289  ret = pfm_get_event_info(event_idx, PFM_OS_PERF_EVENT, &info);
290  if (ret!=PFM_SUCCESS) {
291  return NULL;
292  }
293 
294  /* get the PMU info */
295  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
296  pfm_get_pmu_info(info.pmu, &pinfo);
297 
298  /* calculate the base name, meaning strip off pmu identifier */
299  strncpy(base,name,BUFSIZ);
300  i=0;
301  base_start=base;
302  while(i<strlen(base)) {
303  if (base[i]==':') {
304  if (base[i+1]==':') {
305  i++;
306  base_start=&base[i+1];
307  }
308  else {
309  base[i]=0;
310  }
311  }
312  i++;
313  }
314 
315  /* add the event */
317 
318  new_event=event_table->num_native_events;
319 
320  event_table->native_events[new_event].base_name=strdup(base_start);
321 
322  sprintf(fullname,"%s::%s",pinfo.name,info.name);
323  event_table->native_events[new_event].pmu_plus_name=strdup(fullname);
324 
325  sprintf(pmuplusbase,"%s::%s",pinfo.name,base_start);
326 
327  event_table->native_events[new_event].component=0;
328  event_table->native_events[new_event].pmu=strdup(pinfo.name);
329 
330  event_table->native_events[new_event].libpfm4_idx=
331  find_event_no_aliases(pmuplusbase,event_table->pmu_type);
332 
333  SUBDBG("Using %#x as index instead of %#x for %s\n",
334  event_table->native_events[new_event].libpfm4_idx,
335  event_idx,pmuplusbase);
336 
337  event_table->native_events[new_event].allocated_name=strdup(name);
338 
339  /* is this needed? */
340  event_table->native_events[new_event].users=0;
341 
342 
343  /* use name of the event to get the perf_event encoding */
344 
345  /* clear the attribute structure */
346  memset(&perf_arg,0,sizeof(pfm_perf_encode_arg_t));
347 
348  /* clear out the perf_attr struct */
349  memset(&perf_attr,0,sizeof(struct perf_event_attr));
350  perf_arg.attr=&perf_attr;
351 
352  ret = pfm_get_os_event_encoding(name,
353  PFM_PLM0 | PFM_PLM3,
354  PFM_OS_PERF_EVENT,
355  &perf_arg);
356 
357  /* If we error out on UMASK then enumeration doesn't work */
358  if ((ret==PFM_SUCCESS) || (ret==PFM_ERR_UMASK)) {
359 
360  event_table->native_events[new_event].config=perf_arg.attr->config;
361  event_table->native_events[new_event].config1=perf_arg.attr->config1;
362  event_table->native_events[new_event].type=perf_arg.attr->type;
363 
364  SUBDBG( "pe_event: config 0x%"PRIx64" config1 0x%"PRIx64
365  " type 0x%"PRIx32"\n",
366  perf_arg.attr->config,
367  perf_arg.attr->config1,
368  perf_arg.attr->type);
369 
370  SUBDBG("Creating event %s with perfidx %#x\n",
371  name,
372  event_table->native_events[new_event].libpfm4_idx);
373 
374  event_table->num_native_events++;
375 
376  /* If we've allocated too many native events, then allocate more room */
377  if (event_table->num_native_events >=
378  event_table->allocated_native_events) {
379 
380  SUBDBG("Allocating more room for native events (%d %ld)\n",
382  (long)sizeof(struct native_event_t) *
384 
385  event_table->native_events=realloc(event_table->native_events,
386  sizeof(struct native_event_t) *
389  }
390  }
391 
393 
394  if (event_table->native_events==NULL) {
395  return NULL;
396  }
397 
398  return &event_table->native_events[new_event];
399 
400 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
struct native_event_t * native_events
#define NATIVE_EVENT_CHUNK
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
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 SUBDBG(format, args...)
Definition: papi_debug.h:63
#define NAMELIB_LOCK
Definition: papi_internal.h:93
char * name
Definition: iozone.c:23648
static int find_event_no_aliases(char *name, int pmu_type)

Here is the call graph for this function:

Here is the caller graph for this function:

static int convert_libpfm4_to_string ( int  code,
char **  event_name,
pfm_pmu_info_t *  default_pmu 
)
static

Definition at line 586 of file pe_libpfm4_events.c.

588 {
589 
590  int ret;
591  pfm_event_info_t gete;
592  pfm_pmu_info_t pinfo;
593  char name[BUFSIZ];
594 
595  SUBDBG("ENTER %#x\n",code);
596 
597  /* Clear structures, as wanted by libpfm4 */
598  memset( &gete, 0, sizeof (pfm_event_info_t) );
599 
600  ret=pfm_get_event_info(code, PFM_OS_PERF_EVENT, &gete);
601  if (ret!=PFM_SUCCESS) {
602  return ret;
603  }
604 
605  memset( &pinfo, 0, sizeof(pfm_pmu_info_t) );
606  ret=pfm_get_pmu_info(gete.pmu, &pinfo);
607  if (ret!=PFM_SUCCESS) {
608  return ret;
609  }
610 
611  /* Only prepend PMU name if not on the "default" PMU */
612 
613  if (pinfo.pmu == default_pmu->pmu) {
614  *event_name=strdup(gete.name);
615  }
616  else {
617  sprintf(name,"%s::%s",pinfo.name,gete.name);
618  *event_name=strdup(name);
619  }
620 
621  SUBDBG("Found name: %s\n",*event_name);
622 
623  return PFM_SUCCESS;
624 
625 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
long long ret
Definition: iozone.c:1346
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * name
Definition: iozone.c:23648

Here is the call graph for this function:

Here is the caller graph for this function:

static int convert_pfmidx_to_native ( int  code,
unsigned int PapiEventCode,
struct native_event_table_t event_table 
)
static

Definition at line 642 of file pe_libpfm4_events.c.

643  {
644 
645  int ret;
646  char *name=NULL;
647 
648  ret=convert_libpfm4_to_string( code, &name, &event_table->default_pmu);
649  if (ret!=PFM_SUCCESS) {
650  return _papi_libpfm4_error(ret);
651  }
652 
653  SUBDBG("Converted %#x to %s\n",code,name);
654 
655  ret=_pe_libpfm4_ntv_name_to_code(name,PapiEventCode,event_table);
656 
657  SUBDBG("Converted %s to event %#x\n",name,*PapiEventCode);
658 
659  if (name) free(name);
660 
661  return ret;
662 
663 }
static int convert_libpfm4_to_string(int code, char **event_name, pfm_pmu_info_t *default_pmu)
int _pe_libpfm4_ntv_name_to_code(char *name, unsigned int *event_code, struct native_event_table_t *event_table)
int _papi_libpfm4_error(int pfm_error)
long long ret
Definition: iozone.c:1346
free(dummyfile[xx])
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * name
Definition: iozone.c:23648
pfm_pmu_info_t default_pmu

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_event ( char *  name,
int  pmu_type 
)
static

Definition at line 110 of file pe_libpfm4_events.c.

110  {
111 
112  int ret, actual_idx;
113  pfm_pmu_info_t pinfo;
114  pfm_event_info_t event_info;
115 
116  SUBDBG("Looking for %s\n",name);
117 
118  actual_idx=pfm_find_event(name);
119  if (actual_idx<0) {
120  return PFM_ERR_NOTFOUND;
121  }
122 
123  memset(&event_info,0,sizeof(pfm_event_info_t));
124  ret=pfm_get_event_info(actual_idx, PFM_OS_PERF_EVENT, &event_info);
125  if (ret<0) {
126  return PFM_ERR_NOTFOUND;
127  }
128 
129  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
130  pfm_get_pmu_info(event_info.pmu, &pinfo);
131  if (pmu_is_present_and_right_type(&pinfo,pmu_type)) {
132  return actual_idx;
133  }
134 
135  return PFM_ERR_NOTFOUND;
136 }
memset(eventId, 0, size)
long long ret
Definition: iozone.c:1346
static struct counter_info * event_info
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)
char * name
Definition: iozone.c:23648

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_event_no_aliases ( char *  name,
int  pmu_type 
)
static

Definition at line 150 of file pe_libpfm4_events.c.

150  {
151 
152  int j,i, ret;
153  pfm_pmu_info_t pinfo;
154  pfm_event_info_t event_info;
155  char full_name[BUFSIZ];
156 
157  SUBDBG("Looking for %s\n",name);
158 
159  pfm_for_all_pmus(j) {
160 
161  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
162  pfm_get_pmu_info(j, &pinfo);
163  if (!pmu_is_present_and_right_type(&pinfo,pmu_type)) {
164  continue;
165  }
166 
167  SUBDBG("Looking in pmu %d\n",j);
168  i = pinfo.first_event;
169  while(1) {
170  memset(&event_info,0,sizeof(pfm_event_info_t));
171  ret=pfm_get_event_info(i, PFM_OS_PERF_EVENT, &event_info);
172  if (ret<0) break;
173 
174  sprintf(full_name,"%s::%s",pinfo.name,event_info.name);
175 
176  if (!strcmp(name,full_name)) {
177  SUBDBG("FOUND %s %s %#x\n",name,full_name,i);
178  return i;
179  }
180 
181  if (!strcmp(name,event_info.name)) {
182  SUBDBG("FOUND %s %s %#x\n",name,event_info.name,i);
183  return i;
184  }
185  i=pfm_get_event_next(i);
186  }
187  }
188  return PFM_ERR_NOTFOUND;
189 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
long long ret
Definition: iozone.c:1346
static struct counter_info * event_info
int i
Definition: fileop.c:140
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)
char * name
Definition: iozone.c:23648
long j
Definition: iozone.c:19135

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_existing_event ( char *  name,
struct native_event_table_t event_table 
)
static

Definition at line 32 of file pe_libpfm4_events.c.

33  {
34 
35  int i,event=PAPI_ENOEVNT;
36 
37  SUBDBG("Looking for %s in %d events\n",
38  name,event_table->num_native_events);
39 
41 
42  for(i=0;i<event_table->num_native_events;i++) {
43 
44  if (!strcmp(name,event_table->native_events[i].allocated_name)) {
45  SUBDBG("Found %s (%#x)\n",
46  event_table->native_events[i].allocated_name,
47  event_table->native_events[i].libpfm4_idx);
48  event=i;
49  break;
50  }
51  }
53 
54  if (event<0) { SUBDBG("%s not allocated yet\n",name); }
55 
56  return event;
57 }
struct native_event_t * native_events
#define PAPI_ENOEVNT
Definition: fpapi.h:112
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
int i
Definition: fileop.c:140
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 SUBDBG(format, args...)
Definition: papi_debug.h:63
#define NAMELIB_LOCK
Definition: papi_internal.h:93
char * name
Definition: iozone.c:23648

Here is the call graph for this function:

Here is the caller graph for this function:

static struct native_event_t* find_existing_event_by_number ( int  eventnum,
struct native_event_table_t event_table 
)
static

Definition at line 71 of file pe_libpfm4_events.c.

72  {
73 
74  struct native_event_t *temp_event=NULL;
75 
77 
78  temp_event=&(event_table->native_events[eventnum]);
79 
81 
82  SUBDBG("Found %p for %#x\n",temp_event,eventnum);
83 
84  return temp_event;
85 }
struct native_event_t * native_events
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 SUBDBG(format, args...)
Definition: papi_debug.h:63
#define NAMELIB_LOCK
Definition: papi_internal.h:93

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_max_umask ( struct native_event_t current_event)
static

Definition at line 416 of file pe_libpfm4_events.c.

416  {
417 
418  pfm_event_attr_info_t ainfo;
419  char *b;
420  int a, ret, max =0;
421  pfm_event_info_t info;
422  char event_string[BUFSIZ],*ptr;
423  char temp_string[BUFSIZ];
424 
425  SUBDBG("Trying to find max umask in %s\n",current_event->allocated_name);
426 
427  strcpy(event_string,current_event->allocated_name);
428 
429  /* Skip leading :: delimited PMU name and point to first umask */
430  if (strstr(event_string,"::")) {
431  ptr=strstr(event_string,"::");
432  ptr+=2;
433  b=strtok(ptr,":");
434  }
435  else {
436  b=strtok(event_string,":");
437  }
438 
439  if (!b) {
440  SUBDBG("No colon!\n");
441  return PFM_ERR_UMASK; /* Must be this value!! */
442  }
443 
444  memset(&info,0,sizeof(pfm_event_info_t));
445  ret = pfm_get_event_info(current_event->libpfm4_idx,
446  PFM_OS_PERF_EVENT, &info);
447  if (ret!=PFM_SUCCESS) {
448  SUBDBG("get_event_info failed\n");
449  return PFM_ERR_NOTFOUND;
450  }
451 
452  /* skip first */
453  b=strtok(NULL,":");
454  if (!b) {
455  SUBDBG("Skipping first failed\n");
456  return PFM_ERR_UMASK; /* Must be this value!! */
457  }
458 
459  while(b) {
460  a=0;
461  while(1) {
462 
463  SUBDBG("get_event_attr %#x %d %p\n",current_event->libpfm4_idx,a,&ainfo);
464 
465  memset(&ainfo,0,sizeof(pfm_event_attr_info_t));
466 
467  ret = pfm_get_event_attr_info(current_event->libpfm4_idx, a,
468  PFM_OS_PERF_EVENT, &ainfo);
469 
470  if (ret != PFM_SUCCESS) {
471  SUBDBG("get_event_attr failed %s\n",pfm_strerror(ret));
472  return ret;
473  }
474 
475  SUBDBG("Trying %s with %s\n",ainfo.name,b);
476 
477  if (ainfo.type == PFM_ATTR_MOD_BOOL) {
478  sprintf(temp_string,"%s=0",ainfo.name);
479  if (!strcasecmp(temp_string, b)) {
480  SUBDBG("Found %s %d\n",b,a);
481  if (a>max) max=a;
482  goto found_attr;
483  }
484  }
485  else if (ainfo.type == PFM_ATTR_MOD_INTEGER) {
486  sprintf(temp_string,"%s=0",ainfo.name);
487  if (!strcasecmp(temp_string, b)) {
488  SUBDBG("Found %s %d\n",b,a);
489  if (a>max) max=a;
490  goto found_attr;
491  }
492  }
493  else {
494  if (!strcasecmp(ainfo.name, b)) {
495  SUBDBG("Found %s %d\n",b,a);
496  if (a>max) max=a;
497  goto found_attr;
498  }
499  }
500  a++;
501  }
502 
503  SUBDBG("attr=%s not found for event %s\n", b, info.name);
504 
505  return PFM_ERR_ATTR;
506 
507 found_attr:
508 
509  b=strtok(NULL,":");
510  }
511 
512  SUBDBG("Found max %d\n", max);
513 
514  return max;
515 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
off64_t max
Definition: libasync.c:331
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
long long ret
Definition: iozone.c:1346
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
strcpy(filename, default_filename)
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_next_no_aliases ( int  code,
int  pmu_type 
)
static

Definition at line 203 of file pe_libpfm4_events.c.

203  {
204 
205  int current_pmu=0,current_event=0;
206  pfm_err_t ret;
207  pfm_pmu_info_t pinfo;
208  pfm_event_info_t event_info;
209 
210  /* Clear the structures, as libpfm4 requires it */
211  memset(&event_info,0,sizeof(pfm_event_info_t));
212 
213  ret=pfm_get_event_info(code, PFM_OS_PERF_EVENT, &event_info);
214  if (ret!=PFM_SUCCESS) {
215  return ret;
216  }
217 
218  current_pmu=event_info.pmu;
219  current_event=pfm_get_event_next(code);
220 
221  SUBDBG("Current is %#x guessing next is %#x\n",code,current_event);
222 
223  while(1) {
224 
225  memset(&event_info,0,sizeof(pfm_event_info_t));
226  ret=pfm_get_event_info(current_event, PFM_OS_PERF_EVENT, &event_info);
227  if (ret==PFM_SUCCESS) {
228  SUBDBG("Returning %#x\n",current_event);
229  return current_event;
230  }
231 
232  /* next event not found, so try moving to next PMU */
233 
234  while(1) {
235 
236  current_pmu++;
237  SUBDBG("Incrementing PMU: %#x\n",current_pmu);
238 
239  /* Off the end, so done iterating */
240  if (current_pmu>PFM_PMU_MAX) {
241  return PFM_ERR_NOTFOUND;
242  }
243 
244  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
245  pfm_get_pmu_info(current_pmu, &pinfo);
246  if (pmu_is_present_and_right_type(&pinfo,pmu_type)) break;
247  }
248 
249  current_event=pinfo.first_event;
250 
251  }
252 
253 }
memset(eventId, 0, size)
long long ret
Definition: iozone.c:1346
static struct counter_info * event_info
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_next_umask ( struct native_event_t current_event,
int  current,
char *  umask_name 
)
static

Definition at line 684 of file pe_libpfm4_events.c.

685  {
686 
687  char temp_string[BUFSIZ];
688  pfm_event_info_t event_info;
689  pfm_event_attr_info_t ainfo;
690  int num_masks=0;
691  pfm_err_t ret;
692  int i;
693 
694  /* get number of attributes */
695 
696  memset(&event_info, 0, sizeof(event_info));
697  ret=pfm_get_event_info(current_event->libpfm4_idx,
698  PFM_OS_PERF_EVENT, &event_info);
699  if (ret!=PFM_SUCCESS) {
700  return ret;
701  }
702 
703  SUBDBG("%d possible attributes for event %s\n",
704  event_info.nattrs,
705  event_info.name);
706 
707  pfm_for_each_event_attr(i, &event_info) {
708 
709  ainfo.size = sizeof(ainfo);
710 
711  ret = pfm_get_event_attr_info(event_info.idx, i, PFM_OS_PERF_EVENT,
712  &ainfo);
713  if (ret != PFM_SUCCESS) {
714  SUBDBG("Not found\n");
715  return PFM_ERR_NOTFOUND;
716  }
717 
718  if (ainfo.type == PFM_ATTR_UMASK) {
719  SUBDBG("nm %d looking for %d\n",num_masks,current);
720  if (num_masks==current+1) {
721  SUBDBG("Found attribute %d: %s type: %d\n",
722  i,ainfo.name,ainfo.type);
723 
724  sprintf(temp_string,"%s",ainfo.name);
725  strncpy(umask_name,temp_string,BUFSIZ);
726 
727  return current+1;
728  }
729  num_masks++;
730  }
731 
732  if (ainfo.type == PFM_ATTR_MOD_BOOL) {
733  SUBDBG("nm %d looking for %d\n",num_masks,current);
734 
735  if (num_masks==current+1) {
736  SUBDBG("Found attribute %d: %s type: %d\n",
737  i,ainfo.name,ainfo.type);
738 
739  sprintf(temp_string,"%s=0",ainfo.name);
740  strncpy(umask_name,temp_string,BUFSIZ);
741 
742  return current+1;
743  }
744  num_masks++;
745  }
746 
747  if (ainfo.type == PFM_ATTR_MOD_INTEGER) {
748  SUBDBG("nm %d looking for %d\n",num_masks,current);
749  if (num_masks==current+1) {
750  SUBDBG("Found attribute %d: %s type: %d\n",
751  i,ainfo.name,ainfo.type);
752 
753  sprintf(temp_string,"%s=0",ainfo.name);
754  strncpy(umask_name,temp_string,BUFSIZ);
755 
756  return current+1;
757  }
758  num_masks++;
759  }
760  }
761 
762  return PFM_ERR_ATTR;
763 
764 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
off64_t current
Definition: iozone.c:19505
long long ret
Definition: iozone.c:1346
static struct counter_info * event_info
int i
Definition: fileop.c:140
#define SUBDBG(format, args...)
Definition: papi_debug.h:63

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_event_first_active ( int  pmu_type)
static

Definition at line 528 of file pe_libpfm4_events.c.

529 {
530  int pidx, pmu_idx, ret;
531 
532  pfm_pmu_info_t pinfo;
533 
534  pmu_idx=0;
535 
536  while(pmu_idx<PFM_PMU_MAX) {
537 
538  /* clear the PMU structure (required by libpfm4) */
539  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
540  ret=pfm_get_pmu_info(pmu_idx, &pinfo);
541 
542  if ((ret==PFM_SUCCESS) && pmu_is_present_and_right_type(&pinfo,pmu_type)) {
543 
544  pidx=pinfo.first_event;
545 
546  SUBDBG("First event in %s is %d\n",pinfo.name,pidx);
547 
548  if (pidx<0) {
549  /* For some reason no events available */
550  /* despite the PMU being active. */
551  /* This can happen, for example with ix86arch */
552  /* inside of VMware */
553  }
554  else {
555  return pidx;
556  }
557  }
558 
559  pmu_idx++;
560 
561  }
562 
563  return PAPI_ENOEVNT;
564 
565 }
memset(eventId, 0, size)
#define PAPI_ENOEVNT
Definition: fpapi.h:112
long long ret
Definition: iozone.c:1346
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)

Here is the call graph for this function:

Here is the caller graph for this function:

static int pmu_is_present_and_right_type ( pfm_pmu_info_t *  pinfo,
int  type 
)
static

Definition at line 87 of file pe_libpfm4_events.c.

87  {
88 
89  if (!pinfo->is_present) return 0;
90 
91  if ((pinfo->type==PFM_PMU_TYPE_UNCORE) && (type&PMU_TYPE_UNCORE)) return 1;
92  if ((pinfo->type==PFM_PMU_TYPE_CORE) && (type&PMU_TYPE_CORE)) return 1;
93  if ((pinfo->type==PFM_PMU_TYPE_OS_GENERIC) && (type&PMU_TYPE_OS)) return 1;
94 
95  return 0;
96 }
#define PMU_TYPE_OS
#define PMU_TYPE_CORE
#define PMU_TYPE_UNCORE

Here is the caller graph for this function: