PAPI  5.3.2.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 1342 of file pe_libpfm4_events.c.

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

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

1108 {
1109 
1110 
1111  struct native_event_t *our_event;
1112 
1113  SUBDBG("ENTER %#x\n",EventCode);
1114 
1115  our_event=find_existing_event_by_number(EventCode,event_table);
1116  if (our_event==NULL) {
1117  return PAPI_ENOEVNT;
1118  }
1119 
1120  strncpy(info->symbol, our_event->allocated_name, sizeof(info->symbol));
1121 
1122  if (strlen(our_event->allocated_name) > sizeof(info->symbol)) {
1123  return PAPI_EBUF;
1124  }
1125 
1126  _pe_libpfm4_ntv_code_to_descr(EventCode,info->long_descr,
1127  sizeof(info->long_descr),event_table);
1128 
1129  return PAPI_OK;
1130 }
#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 854 of file pe_libpfm4_events.c.

857 {
858 
859  struct native_event_t *our_event;
860 
861  SUBDBG("ENTER %#x\n",EventCode);
862 
863  our_event=find_existing_event_by_number(EventCode,event_table);
864  if (our_event==NULL) {
865  return PAPI_ENOEVNT;
866  }
867 
868  strncpy(ntv_name,our_event->allocated_name,len);
869 
870  if (strlen(our_event->allocated_name) > (unsigned)len) {
871  return PAPI_EBUF;
872  }
873 
874  return PAPI_OK;
875 }
#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 1151 of file pe_libpfm4_events.c.

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

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

1454  {
1455 
1456  struct native_event_t *our_event;
1457 
1458  our_event=find_existing_event_by_number(event,event_table);
1459  if (our_event==NULL) {
1460  return PAPI_ENOEVNT;
1461  }
1462 
1463  attr->config=our_event->config;
1464  attr->config1=our_event->config1;
1465  attr->config2=our_event->config2;
1466  attr->type=our_event->type;
1467 
1468  SUBDBG( "pe_event: config %#lx config1 %#lx type %#x\n",
1469  attr->config,
1470  attr->config1,
1471  attr->type);
1472 
1473 
1474  return PAPI_OK;
1475 }
#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 1301 of file pe_libpfm4_events.c.

1301  {
1302 
1303  int i;
1304 
1305  APIDBG("Entry\n");
1306 
1307  /* clean out and free the native events structure */
1309 
1310  /* free memory allocate with strdup */
1311  for( i=0; i<event_table->num_native_events; i++) {
1312  free(event_table->native_events[i].base_name);
1313  free(event_table->native_events[i].pmu_plus_name);
1314  free(event_table->native_events[i].pmu);
1315  free(event_table->native_events[i].allocated_name);
1316  }
1317 
1318  memset(event_table->native_events,0,
1319  sizeof(struct native_event_t)*event_table->allocated_native_events);
1320  event_table->num_native_events=0;
1321  event_table->allocated_native_events=0;
1322  free(event_table->native_events);
1323 
1325 
1326  return PAPI_OK;
1327 }
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 %#lx config1 %#lx type %#x\n",
365  perf_arg.attr->config,
366  perf_arg.attr->config1,
367  perf_arg.attr->type);
368 
369  SUBDBG("Creating event %s with perfidx %#x\n",
370  name,
371  event_table->native_events[new_event].libpfm4_idx);
372 
373  event_table->num_native_events++;
374 
375  /* If we've allocated too many native events, then allocate more room */
376  if (event_table->num_native_events >=
377  event_table->allocated_native_events) {
378 
379  SUBDBG("Allocating more room for native events (%d %ld)\n",
381  (long)sizeof(struct native_event_t) *
383 
384  event_table->native_events=realloc(event_table->native_events,
385  sizeof(struct native_event_t) *
388  }
389  }
390 
392 
393  if (event_table->native_events==NULL) {
394  return NULL;
395  }
396 
397  return &event_table->native_events[new_event];
398 
399 }
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 585 of file pe_libpfm4_events.c.

587 {
588 
589  int ret;
590  pfm_event_info_t gete;
591  pfm_pmu_info_t pinfo;
592  char name[BUFSIZ];
593 
594  SUBDBG("ENTER %#x\n",code);
595 
596  /* Clear structures, as wanted by libpfm4 */
597  memset( &gete, 0, sizeof (pfm_event_info_t) );
598 
599  ret=pfm_get_event_info(code, PFM_OS_PERF_EVENT, &gete);
600  if (ret!=PFM_SUCCESS) {
601  return ret;
602  }
603 
604  memset( &pinfo, 0, sizeof(pfm_pmu_info_t) );
605  ret=pfm_get_pmu_info(gete.pmu, &pinfo);
606  if (ret!=PFM_SUCCESS) {
607  return ret;
608  }
609 
610  /* Only prepend PMU name if not on the "default" PMU */
611 
612  if (pinfo.pmu == default_pmu->pmu) {
613  *event_name=strdup(gete.name);
614  }
615  else {
616  sprintf(name,"%s::%s",pinfo.name,gete.name);
617  *event_name=strdup(name);
618  }
619 
620  SUBDBG("Found name: %s\n",*event_name);
621 
622  return PFM_SUCCESS;
623 
624 }
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 641 of file pe_libpfm4_events.c.

642  {
643 
644  int ret;
645  char *name=NULL;
646 
647  ret=convert_libpfm4_to_string( code, &name, &event_table->default_pmu);
648  if (ret!=PFM_SUCCESS) {
649  return _papi_libpfm4_error(ret);
650  }
651 
652  SUBDBG("Converted %#x to %s\n",code,name);
653 
654  ret=_pe_libpfm4_ntv_name_to_code(name,PapiEventCode,event_table);
655 
656  SUBDBG("Converted %s to event %#x\n",name,*PapiEventCode);
657 
658  if (name) free(name);
659 
660  return ret;
661 
662 }
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 415 of file pe_libpfm4_events.c.

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

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

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