PAPI  5.3.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
peu_libpfm4_events.c File Reference
Include dependency graph for peu_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)
 
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 _peu_libpfm4_ntv_name_to_code (char *name, unsigned int *event_code, struct native_event_table_t *event_table)
 
int _peu_libpfm4_ntv_code_to_name (unsigned int EventCode, char *ntv_name, int len, struct native_event_table_t *event_table)
 
int _peu_libpfm4_ntv_code_to_descr (unsigned int EventCode, char *ntv_descr, int len, struct native_event_table_t *event_table)
 
int _peu_libpfm4_ntv_code_to_info (unsigned int EventCode, PAPI_event_info_t *info, struct native_event_table_t *event_table)
 
int _peu_libpfm4_ntv_enum_events (unsigned int *PapiEventCode, int modifier, struct native_event_table_t *event_table)
 
int _peu_libpfm4_shutdown (struct native_event_table_t *event_table)
 
int _peu_libpfm4_init (papi_vector_t *my_vector, struct native_event_table_t *event_table, int pmu_type)
 
int _peu_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 20 of file peu_libpfm4_events.c.

Function Documentation

int _peu_libpfm4_init ( papi_vector_t my_vector,
struct native_event_table_t event_table,
int  pmu_type 
)

Definition at line 1330 of file peu_libpfm4_events.c.

1332  {
1333 
1334  int detected_pmus=0;
1335  int i;
1336  pfm_err_t retval = PFM_SUCCESS;
1337  unsigned int ncnt;
1338  pfm_pmu_info_t pinfo;
1339 
1340  /* allocate the native event structure */
1341 
1342  event_table->num_native_events=0;
1343  event_table->pmu_type=pmu_type;
1344 
1345  event_table->native_events=calloc(NATIVE_EVENT_CHUNK,
1346  sizeof(struct native_event_t));
1347  if (event_table->native_events==NULL) {
1348  return PAPI_ENOMEM;
1349  }
1351 
1352  /* Count number of present PMUs */
1353  detected_pmus=0;
1354  ncnt=0;
1355 
1356  my_vector->cmp_info.num_cntrs=0;
1357 
1358  SUBDBG("Detected pmus:\n");
1359  for(i=0;i<PFM_PMU_MAX;i++) {
1360  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
1361  retval=pfm_get_pmu_info(i, &pinfo);
1362  if (retval!=PFM_SUCCESS) {
1363  continue;
1364  }
1365 
1366  if (pmu_is_present_and_right_type(&pinfo,pmu_type)) {
1367  SUBDBG("\t%d %s %s %d\n",i,pinfo.name,pinfo.desc,pinfo.type);
1368 
1369  detected_pmus++;
1370  ncnt+=pinfo.nevents;
1371 
1372  my_vector->cmp_info.num_cntrs += pinfo.num_cntrs+
1373  pinfo.num_fixed_cntrs;
1374  }
1375  }
1376  SUBDBG("%d native events detected on %d pmus\n",ncnt,detected_pmus);
1377 
1378  my_vector->cmp_info.num_native_events = ncnt;
1379 
1380  SUBDBG( "num_counters: %d\n", my_vector->cmp_info.num_cntrs );
1381 
1382  return PAPI_OK;
1383 }
memset(eventId, 0, size)
#define PAPI_ENOMEM
Definition: fpapi.h:107
struct native_event_t * native_events
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
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)
ssize_t retval
Definition: libasync.c:338
#define NATIVE_EVENT_CHUNK

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 889 of file peu_libpfm4_events.c.

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

Definition at line 1093 of file peu_libpfm4_events.c.

1096 {
1097 
1098 
1099  struct native_event_t *our_event;
1100 
1101  SUBDBG("ENTER %#x\n",EventCode);
1102 
1103  our_event=find_existing_event_by_number(EventCode,event_table);
1104  if (our_event==NULL) {
1105  return PAPI_ENOEVNT;
1106  }
1107 
1108  strncpy(info->symbol, our_event->allocated_name, sizeof(info->symbol));
1109 
1110  if (strlen(our_event->allocated_name) > sizeof(info->symbol)) {
1111  return PAPI_EBUF;
1112  }
1113 
1115  sizeof(info->long_descr),event_table);
1116 
1117  return PAPI_OK;
1118 }
#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
int _peu_libpfm4_ntv_code_to_descr(unsigned int EventCode, char *ntv_descr, int len, struct native_event_table_t *event_table)
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static struct native_event_t * find_existing_event_by_number(int eventnum, 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 _peu_libpfm4_ntv_code_to_name ( unsigned int  EventCode,
char *  ntv_name,
int  len,
struct native_event_table_t event_table 
)

Definition at line 842 of file peu_libpfm4_events.c.

845 {
846 
847  struct native_event_t *our_event;
848 
849  SUBDBG("ENTER %#x\n",EventCode);
850 
851  our_event=find_existing_event_by_number(EventCode,event_table);
852  if (our_event==NULL) {
853  return PAPI_ENOEVNT;
854  }
855 
856  strncpy(ntv_name,our_event->allocated_name,len);
857 
858  if (strlen(our_event->allocated_name) > (unsigned)len) {
859  return PAPI_EBUF;
860  }
861 
862  return PAPI_OK;
863 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static struct native_event_t * find_existing_event_by_number(int eventnum, 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 _peu_libpfm4_ntv_enum_events ( unsigned int PapiEventCode,
int  modifier,
struct native_event_table_t event_table 
)

Definition at line 1139 of file peu_libpfm4_events.c.

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

Definition at line 775 of file peu_libpfm4_events.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1401 of file peu_libpfm4_events.c.

1403  {
1404 
1405  struct native_event_t *our_event;
1406 
1407  our_event=find_existing_event_by_number(event,event_table);
1408  if (our_event==NULL) {
1409  return PAPI_ENOEVNT;
1410  }
1411 
1412  attr->config=our_event->config;
1413  attr->config1=our_event->config1;
1414  attr->config2=our_event->config2;
1415  attr->type=our_event->type;
1416 
1417  SUBDBG( "pe_event: config 0x%"PRIx64
1418  " config1 0x%"PRIx64
1419  " type 0x%"PRIx32"\n",
1420  attr->config,
1421  attr->config1,
1422  attr->type);
1423 
1424  return PAPI_OK;
1425 }
#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
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static struct native_event_t * find_existing_event_by_number(int eventnum, struct native_event_table_t *event_table)

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_shutdown ( struct native_event_table_t event_table)

Definition at line 1288 of file peu_libpfm4_events.c.

1288  {
1289 
1290  int i;
1291 
1292  APIDBG("Entry\n");
1293 
1294  /* clean out and free the native events structure */
1296 
1297  /* Only free if we're the last user */
1298 
1299  /* free memory allocated with strdup */
1300  for( i=0; i<event_table->num_native_events; i++) {
1301  free(event_table->native_events[i].base_name);
1302  free(event_table->native_events[i].pmu_plus_name);
1303  free(event_table->native_events[i].pmu);
1304  free(event_table->native_events[i].allocated_name);
1305  }
1306 
1307  memset(event_table->native_events,0,
1308  sizeof(struct native_event_t)*event_table->allocated_native_events);
1309  event_table->num_native_events=0;
1310  event_table->allocated_native_events=0;
1311  free(event_table->native_events);
1312 
1314 
1315  return PAPI_OK;
1316 }
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 271 of file peu_libpfm4_events.c.

273  {
274 
275  int new_event;
276 
277  pfm_err_t ret;
278  unsigned int i;
279  char *base_start;
280  pfm_event_info_t info;
281  pfm_pmu_info_t pinfo;
282  char base[BUFSIZ],pmuplusbase[BUFSIZ];
283  char fullname[BUFSIZ];
284 
285  pfm_perf_encode_arg_t perf_arg;
286 
287  struct perf_event_attr perf_attr;
288 
289  /* get the event name from libpfm */
290  memset(&info,0,sizeof(pfm_event_info_t));
291  ret = pfm_get_event_info(event_idx, PFM_OS_PERF_EVENT, &info);
292  if (ret!=PFM_SUCCESS) {
293  return NULL;
294  }
295 
296  /* get the PMU info */
297  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
298  pfm_get_pmu_info(info.pmu, &pinfo);
299 
300  /* calculate the base name, meaning strip off pmu identifier */
301  strncpy(base,name,BUFSIZ);
302  i=0;
303  base_start=base;
304  while(i<strlen(base)) {
305  if (base[i]==':') {
306  if (base[i+1]==':') {
307  i++;
308  base_start=&base[i+1];
309  }
310  else {
311  base[i]=0;
312  }
313  }
314  i++;
315  }
316 
317  /* add the event */
319 
320  new_event=event_table->num_native_events;
321 
322  event_table->native_events[new_event].base_name=strdup(base_start);
323 
324  sprintf(fullname,"%s::%s",pinfo.name,info.name);
325  event_table->native_events[new_event].pmu_plus_name=strdup(fullname);
326 
327  sprintf(pmuplusbase,"%s::%s",pinfo.name,base_start);
328 
329  event_table->native_events[new_event].component=0;
330  event_table->native_events[new_event].pmu=strdup(pinfo.name);
331 
332  event_table->native_events[new_event].libpfm4_idx=
333  find_event_no_aliases(pmuplusbase,event_table->pmu_type);
334 
335  SUBDBG("Using %#x as index instead of %#x for %s\n",
336  event_table->native_events[new_event].libpfm4_idx,
337  event_idx,pmuplusbase);
338 
339  event_table->native_events[new_event].allocated_name=strdup(name);
340 
341  /* is this needed? */
342  event_table->native_events[new_event].users=0;
343 
344 
345  /* use name of the event to get the perf_event encoding */
346 
347  /* clear the attribute structure */
348  memset(&perf_arg,0,sizeof(pfm_perf_encode_arg_t));
349 
350  /* clear out the perf_attr struct */
351  memset(&perf_attr,0,sizeof(struct perf_event_attr));
352  perf_arg.attr=&perf_attr;
353 
354  ret = pfm_get_os_event_encoding(name,
355  PFM_PLM0 | PFM_PLM3,
356  PFM_OS_PERF_EVENT,
357  &perf_arg);
358  if (ret==PFM_SUCCESS) {
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, 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  }
391 
392  if (event_table->native_events==NULL) {
393  return NULL;
394  }
395 
396  return &event_table->native_events[new_event];
397 
398 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
struct native_event_t * native_events
long long ret
Definition: iozone.c:1346
static int find_event_no_aliases(char *name, int pmu_type)
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
#define NATIVE_EVENT_CHUNK

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 
)
static

Definition at line 582 of file peu_libpfm4_events.c.

583 {
584 
585  int ret;
586  pfm_event_info_t gete;
587  pfm_pmu_info_t pinfo;
588  char name[BUFSIZ];
589 
590  SUBDBG("ENTER %#x\n",code);
591 
592  /* Clear structures, as wanted by libpfm4 */
593  memset( &gete, 0, sizeof (pfm_event_info_t) );
594 
595  ret=pfm_get_event_info(code, PFM_OS_PERF_EVENT, &gete);
596  if (ret!=PFM_SUCCESS) {
597  return ret;
598  }
599 
600  memset( &pinfo, 0, sizeof(pfm_pmu_info_t) );
601  ret=pfm_get_pmu_info(gete.pmu, &pinfo);
602  if (ret!=PFM_SUCCESS) {
603  return ret;
604  }
605 
606  sprintf(name,"%s::%s",pinfo.name,gete.name);
607  *event_name=strdup(name);
608 
609  SUBDBG("Found name: %s\n",*event_name);
610 
611  return PFM_SUCCESS;
612 
613 }
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 630 of file peu_libpfm4_events.c.

631  {
632 
633  int ret;
634  char *name=NULL;
635 
636  ret=convert_libpfm4_to_string( code, &name);
637  if (ret!=PFM_SUCCESS) {
638  return _papi_libpfm4_error(ret);
639  }
640 
641  SUBDBG("Converted %#x to %s\n",code,name);
642 
643  ret=_peu_libpfm4_ntv_name_to_code(name,PapiEventCode,event_table);
644 
645  SUBDBG("Converted %s to event %#x\n",name,*PapiEventCode);
646 
647  if (name) free(name);
648 
649  return ret;
650 
651 }
static int convert_libpfm4_to_string(int code, char **event_name)
int _papi_libpfm4_error(int pfm_error)
long long ret
Definition: iozone.c:1346
int _peu_libpfm4_ntv_name_to_code(char *name, unsigned int *event_code, struct native_event_table_t *event_table)
free(dummyfile[xx])
#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 find_event ( char *  name,
int  pmu_type 
)
static

Definition at line 112 of file peu_libpfm4_events.c.

112  {
113 
114  int ret, actual_idx;
115  pfm_pmu_info_t pinfo;
116  pfm_event_info_t event_info;
117 
118  SUBDBG("Looking for %s\n",name);
119 
120  actual_idx=pfm_find_event(name);
121  if (actual_idx<0) {
122  return PFM_ERR_NOTFOUND;
123  }
124 
125  memset(&event_info,0,sizeof(pfm_event_info_t));
126  ret=pfm_get_event_info(actual_idx, PFM_OS_PERF_EVENT, &event_info);
127  if (ret<0) {
128  return PFM_ERR_NOTFOUND;
129  }
130 
131  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
132  pfm_get_pmu_info(event_info.pmu, &pinfo);
133  if (pmu_is_present_and_right_type(&pinfo,pmu_type)) {
134  return actual_idx;
135  }
136 
137  return PFM_ERR_NOTFOUND;
138 }
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
char * name
Definition: iozone.c:23648
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_event_no_aliases ( char *  name,
int  pmu_type 
)
static

Definition at line 152 of file peu_libpfm4_events.c.

152  {
153 
154  int j,i, ret;
155  pfm_pmu_info_t pinfo;
156  pfm_event_info_t event_info;
157  char full_name[BUFSIZ];
158 
159  SUBDBG("Looking for %s\n",name);
160 
161  pfm_for_all_pmus(j) {
162 
163  memset(&pinfo,0,sizeof(pfm_pmu_info_t));
164  pfm_get_pmu_info(j, &pinfo);
165  if (!pmu_is_present_and_right_type(&pinfo,pmu_type)) {
166  continue;
167  }
168 
169  SUBDBG("Looking in pmu %d\n",j);
170  i = pinfo.first_event;
171  while(1) {
172  memset(&event_info,0,sizeof(pfm_event_info_t));
173  ret=pfm_get_event_info(i, PFM_OS_PERF_EVENT, &event_info);
174  if (ret<0) break;
175 
176  sprintf(full_name,"%s::%s",pinfo.name,event_info.name);
177 
178  if (!strcmp(name,full_name)) {
179  SUBDBG("FOUND %s %s %#x\n",name,full_name,i);
180  return i;
181  }
182 
183  if (!strcmp(name,event_info.name)) {
184  SUBDBG("FOUND %s %s %#x\n",name,event_info.name,i);
185  return i;
186  }
187  i=pfm_get_event_next(i);
188  }
189  }
190  return PFM_ERR_NOTFOUND;
191 }
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
char * name
Definition: iozone.c:23648
static int pmu_is_present_and_right_type(pfm_pmu_info_t *pinfo, int type)
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 34 of file peu_libpfm4_events.c.

35  {
36 
37  int i,event=PAPI_ENOEVNT;
38 
39  SUBDBG("Looking for %s in %d events\n",
40  name,event_table->num_native_events);
41 
43 
44  for(i=0;i<event_table->num_native_events;i++) {
45 
46  if (!strcmp(name,event_table->native_events[i].allocated_name)) {
47  SUBDBG("Found %s (%#x)\n",
48  event_table->native_events[i].allocated_name,
49  event_table->native_events[i].libpfm4_idx);
50  event=i;
51  break;
52  }
53  }
55 
56  if (event<0) { SUBDBG("%s not allocated yet\n",name); }
57 
58  return event;
59 }
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 73 of file peu_libpfm4_events.c.

74  {
75 
76  struct native_event_t *temp_event=NULL;
77 
79 
80  temp_event=&(event_table->native_events[eventnum]);
81 
83 
84  SUBDBG("Found %p for %#x\n",temp_event,eventnum);
85 
86  return temp_event;
87 }
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 414 of file peu_libpfm4_events.c.

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

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

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

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

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

Here is the caller graph for this function: