PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
perf_event_lib.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pe_event_info_t
 
struct  pe_control_t
 
struct  pe_context_t
 

Macros

#define PERF_EVENT_MAX_MPX_COUNTERS   128
 

Functions

int _pe_shutdown_thread (hwd_context_t *ctx)
 
int _pe_reset (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
int _pe_write (hwd_context_t *ctx, hwd_control_state_t *ctl, long long *from)
 
int _pe_read (hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
 
int _pe_start (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
int _pe_stop (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
int _pe_ctl (hwd_context_t *ctx, int code, _papi_int_option_t *option)
 

Macro Definition Documentation

#define PERF_EVENT_MAX_MPX_COUNTERS   128

Definition at line 5 of file perf_event_lib.h.

Function Documentation

int _pe_ctl ( hwd_context_t ctx,
int  code,
_papi_int_option_t option 
)

Definition at line 1337 of file perf_event.c.

1338 {
1339  int ret;
1340  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1341  pe_control_t *pe_ctl = NULL;
1342 
1343  switch ( code ) {
1344  case PAPI_MULTIPLEX:
1345  pe_ctl = ( pe_control_t * ) ( option->multiplex.ESI->ctl_state );
1346  ret = check_permissions( pe_ctl->tid, pe_ctl->cpu, pe_ctl->domain,
1347  pe_ctl->granularity,
1348  1, pe_ctl->inherit );
1349  if (ret != PAPI_OK) {
1350  return ret;
1351  }
1352 
1353  /* looks like we are allowed, so set multiplexed attribute */
1354  pe_ctl->multiplexed = 1;
1355  ret = _pe_update_control_state( pe_ctl, NULL,
1356  pe_ctl->num_events, pe_ctx );
1357  if (ret != PAPI_OK) {
1358  pe_ctl->multiplexed = 0;
1359  }
1360  return ret;
1361 
1362  case PAPI_ATTACH:
1363  pe_ctl = ( pe_control_t * ) ( option->attach.ESI->ctl_state );
1364  ret = check_permissions( option->attach.tid, pe_ctl->cpu,
1365  pe_ctl->domain, pe_ctl->granularity,
1366  pe_ctl->multiplexed,
1367  pe_ctl->inherit );
1368  if (ret != PAPI_OK) {
1369  return ret;
1370  }
1371 
1372  pe_ctl->tid = option->attach.tid;
1373 
1374  /* If events have been already been added, something may */
1375  /* have been done to the kernel, so update */
1376  ret =_pe_update_control_state( pe_ctl, NULL,
1377  pe_ctl->num_events, pe_ctx);
1378 
1379  return ret;
1380 
1381  case PAPI_DETACH:
1382  pe_ctl = ( pe_control_t *) ( option->attach.ESI->ctl_state );
1383 
1384  pe_ctl->tid = 0;
1385  return PAPI_OK;
1386 
1387  case PAPI_CPU_ATTACH:
1388  pe_ctl = ( pe_control_t *) ( option->cpu.ESI->ctl_state );
1389  ret = check_permissions( pe_ctl->tid, option->cpu.cpu_num,
1390  pe_ctl->domain, pe_ctl->granularity,
1391  pe_ctl->multiplexed,
1392  pe_ctl->inherit );
1393  if (ret != PAPI_OK) {
1394  return ret;
1395  }
1396  /* looks like we are allowed so set cpu number */
1397 
1398  /* this tells the kernel not to count for a thread */
1399  /* should we warn if we try to set both? perf_event */
1400  /* will reject it. */
1401  pe_ctl->tid = -1;
1402 
1403  pe_ctl->cpu = option->cpu.cpu_num;
1404 
1405  return PAPI_OK;
1406 
1407  case PAPI_DOMAIN:
1408  pe_ctl = ( pe_control_t *) ( option->domain.ESI->ctl_state );
1409  ret = check_permissions( pe_ctl->tid, pe_ctl->cpu,
1410  option->domain.domain,
1411  pe_ctl->granularity,
1412  pe_ctl->multiplexed,
1413  pe_ctl->inherit );
1414  if (ret != PAPI_OK) {
1415  return ret;
1416  }
1417  /* looks like we are allowed, so set event set level counting domains */
1418  pe_ctl->domain = option->domain.domain;
1419  return PAPI_OK;
1420 
1421  case PAPI_GRANUL:
1422  pe_ctl = (pe_control_t *) ( option->granularity.ESI->ctl_state );
1423 
1424  /* FIXME: we really don't support this yet */
1425 
1426  switch ( option->granularity.granularity ) {
1427  case PAPI_GRN_PROCG:
1428  case PAPI_GRN_SYS_CPU:
1429  case PAPI_GRN_PROC:
1430  return PAPI_ECMP;
1431 
1432  /* Currently we only support thread and CPU granularity */
1433  case PAPI_GRN_SYS:
1434  pe_ctl->granularity=PAPI_GRN_SYS;
1435  break;
1436 
1437  case PAPI_GRN_THR:
1438  pe_ctl->granularity=PAPI_GRN_THR;
1439  break;
1440 
1441 
1442  default:
1443  return PAPI_EINVAL;
1444  }
1445  return PAPI_OK;
1446 
1447  case PAPI_INHERIT:
1448  pe_ctl = (pe_control_t *) ( option->inherit.ESI->ctl_state );
1449  ret = check_permissions( pe_ctl->tid, pe_ctl->cpu, pe_ctl->domain,
1450  pe_ctl->granularity, pe_ctl->multiplexed,
1451  option->inherit.inherit );
1452  if (ret != PAPI_OK) {
1453  return ret;
1454  }
1455  /* looks like we are allowed, so set the requested inheritance */
1456  if (option->inherit.inherit) {
1457  /* children will inherit counters */
1458  pe_ctl->inherit = 1;
1459  } else {
1460  /* children won't inherit counters */
1461  pe_ctl->inherit = 0;
1462  }
1463  return PAPI_OK;
1464 
1465  case PAPI_DATA_ADDRESS:
1466  return PAPI_ENOSUPP;
1467 #if 0
1468  pe_ctl = (pe_control_t *) (option->address_range.ESI->ctl_state);
1469  ret = set_default_domain( pe_ctl, option->address_range.domain );
1470  if ( ret != PAPI_OK ) {
1471  return ret;
1472  }
1473  set_drange( pe_ctx, pe_ctl, option );
1474  return PAPI_OK;
1475 #endif
1476  case PAPI_INSTR_ADDRESS:
1477  return PAPI_ENOSUPP;
1478 #if 0
1479  pe_ctl = (pe_control_t *) (option->address_range.ESI->ctl_state);
1480  ret = set_default_domain( pe_ctl, option->address_range.domain );
1481  if ( ret != PAPI_OK ) {
1482  return ret;
1483  }
1484  set_irange( pe_ctx, pe_ctl, option );
1485  return PAPI_OK;
1486 #endif
1487 
1488  case PAPI_DEF_ITIMER:
1489  /* What should we be checking for here? */
1490  /* This seems like it should be OS-specific not component */
1491  /* specific. */
1492 
1493  return PAPI_OK;
1494 
1495  case PAPI_DEF_MPX_NS:
1496  /* Defining a given ns per set is not current supported */
1497  return PAPI_ENOSUPP;
1498 
1499  case PAPI_DEF_ITIMER_NS:
1500  /* We don't support this... */
1501  return PAPI_OK;
1502 
1503  default:
1504  return PAPI_ENOSUPP;
1505  }
1506 }
_papi_int_inherit_t inherit
#define PAPI_CPU_ATTACH
Definition: papi.h:455
EventSetInfo_t * ESI
unsigned int granularity
#define PAPI_DEF_ITIMER_NS
Definition: papi.h:453
EventSetInfo_t * ESI
#define PAPI_INSTR_ADDRESS
Definition: papi.h:451
#define PAPI_DEF_MPX_NS
Definition: papi.h:434
_papi_int_addr_range_t address_range
#define PAPI_ENOSUPP
Definition: papi.h:269
#define PAPI_DATA_ADDRESS
Definition: papi.h:450
EventSetInfo_t * ESI
static int set_irange(hwd_context_t *ctx, hwd_control_state_t *current_state, _papi_int_option_t *option)
Definition: perfmon-ia64.c:919
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
static int check_permissions(unsigned long tid, unsigned int cpu_num, unsigned int domain, unsigned int granularity, unsigned int multiplex, unsigned int inherit)
Definition: perf_event.c:413
static int set_default_domain(EventSetInfo_t *zero, int domain)
Definition: aix.c:510
#define PAPI_INHERIT
Definition: papi.h:456
unsigned int domain
_papi_int_attach_t attach
long long ret
Definition: iozone.c:1346
unsigned long tid
int _pe_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
Definition: perf_event.c:1209
_papi_int_cpu_t cpu
#define PAPI_GRANUL
Definition: papi.h:433
_papi_int_granularity_t granularity
EventSetInfo_t * ESI
#define PAPI_DETACH
Definition: papi.h:427
unsigned int multiplexed
#define PAPI_ATTACH
Definition: papi.h:445
#define PAPI_ECMP
Definition: papi.h:254
#define PAPI_MULTIPLEX
Definition: papi.h:429
#define PAPI_GRN_THR
Definition: papi.h:360
EventSetInfo_t * ESI
#define PAPI_GRN_SYS_CPU
Definition: papi.h:365
_papi_int_multiplex_t multiplex
#define PAPI_DOMAIN
Definition: papi.h:431
unsigned int cpu_num
static int set_drange(hwd_context_t *ctx, hwd_control_state_t *current_state, _papi_int_option_t *option)
Definition: perfmon-ia64.c:767
#define PAPI_DEF_ITIMER
Definition: papi.h:452
unsigned int inherit
_papi_int_domain_t domain
#define PAPI_GRN_PROCG
Definition: papi.h:363
EventSetInfo_t * ESI
#define PAPI_GRN_SYS
Definition: papi.h:364
hwd_control_state_t * ctl_state
EventSetInfo_t * ESI
#define PAPI_GRN_PROC
Definition: papi.h:362

Here is the call graph for this function:

int _pe_read ( hwd_context_t ctx,
hwd_control_state_t ctl,
long long **  events,
int  flags 
)

Definition at line 930 of file perf_event.c.

932 {
933  SUBDBG("ENTER: ctx: %p, ctl: %p, events: %p, flags: %#x\n", ctx, ctl, events, flags);
934 
935  ( void ) flags; /*unused */
936  int i, ret = -1;
937  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
938  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
939  long long papi_pe_buffer[READ_BUFFER_SIZE];
940  long long tot_time_running, tot_time_enabled, scale;
941 
942  /* On kernels before 2.6.33 the TOTAL_TIME_ENABLED and TOTAL_TIME_RUNNING */
943  /* fields are always 0 unless the counter is disabled. So if we are on */
944  /* one of these kernels, then we must disable events before reading. */
945 
946  /* Elsewhere though we disable multiplexing on kernels before 2.6.34 */
947  /* so maybe this isn't even necessary. */
948 
949  if (bug_sync_read()) {
950  if ( pe_ctx->state & PERF_EVENTS_RUNNING ) {
951  for ( i = 0; i < pe_ctl->num_events; i++ ) {
952  /* disable only the group leaders */
953  if ( pe_ctl->events[i].group_leader_fd == -1 ) {
954  ret = ioctl( pe_ctl->events[i].event_fd,
955  PERF_EVENT_IOC_DISABLE, NULL );
956  if ( ret == -1 ) {
957  PAPIERROR("ioctl(PERF_EVENT_IOC_DISABLE) "
958  "returned an error: ", strerror( errno ));
959  return PAPI_ESYS;
960  }
961  }
962  }
963  }
964  }
965 
966 
967  /* Handle case where we are multiplexing */
968  if (pe_ctl->multiplexed) {
969 
970  /* currently we handle multiplexing by having individual events */
971  /* so we read from each in turn. */
972 
973  for ( i = 0; i < pe_ctl->num_events; i++ ) {
974 
975  ret = read( pe_ctl->events[i].event_fd, papi_pe_buffer,
976  sizeof ( papi_pe_buffer ) );
977  if ( ret == -1 ) {
978  PAPIERROR("read returned an error: ", strerror( errno ));
979  return PAPI_ESYS;
980  }
981 
982  /* We should read 3 64-bit values from the counter */
983  if (ret<(signed)(3*sizeof(long long))) {
984  PAPIERROR("Error! short read");
985  return PAPI_ESYS;
986  }
987 
988  SUBDBG("read: fd: %2d, tid: %ld, cpu: %d, ret: %d\n",
989  pe_ctl->events[i].event_fd,
990  (long)pe_ctl->tid, pe_ctl->events[i].cpu, ret);
991  SUBDBG("read: %lld %lld %lld\n",papi_pe_buffer[0],
992  papi_pe_buffer[1],papi_pe_buffer[2]);
993 
994  tot_time_enabled = papi_pe_buffer[1];
995  tot_time_running = papi_pe_buffer[2];
996 
997  SUBDBG("count[%d] = (papi_pe_buffer[%d] %lld * "
998  "tot_time_enabled %lld) / tot_time_running %lld\n",
999  i, 0,papi_pe_buffer[0],
1000  tot_time_enabled,tot_time_running);
1001 
1002  if (tot_time_running == tot_time_enabled) {
1003  /* No scaling needed */
1004  pe_ctl->counts[i] = papi_pe_buffer[0];
1005  } else if (tot_time_running && tot_time_enabled) {
1006  /* Scale factor of 100 to avoid overflows when computing */
1007  /*enabled/running */
1008 
1009  scale = (tot_time_enabled * 100LL) / tot_time_running;
1010  scale = scale * papi_pe_buffer[0];
1011  scale = scale / 100LL;
1012  pe_ctl->counts[i] = scale;
1013  } else {
1014  /* This should not happen, but Phil reports it sometime does. */
1015  SUBDBG("perf_event kernel bug(?) count, enabled, "
1016  "running: %lld, %lld, %lld\n",
1017  papi_pe_buffer[0],tot_time_enabled,
1018  tot_time_running);
1019 
1020  pe_ctl->counts[i] = papi_pe_buffer[0];
1021  }
1022  }
1023  }
1024 
1025  /* Handle cases where we cannot use FORMAT GROUP */
1026  else if (bug_format_group() || pe_ctl->inherit) {
1027 
1028  /* we must read each counter individually */
1029  for ( i = 0; i < pe_ctl->num_events; i++ ) {
1030 
1031  ret = read( pe_ctl->events[i].event_fd, papi_pe_buffer,
1032  sizeof ( papi_pe_buffer ) );
1033  if ( ret == -1 ) {
1034  PAPIERROR("read returned an error: ", strerror( errno ));
1035  return PAPI_ESYS;
1036  }
1037 
1038  /* we should read one 64-bit value from each counter */
1039  if (ret!=sizeof(long long)) {
1040  PAPIERROR("Error! short read");
1041  PAPIERROR("read: fd: %2d, tid: %ld, cpu: %d, ret: %d",
1042  pe_ctl->events[i].event_fd,
1043  (long)pe_ctl->tid, pe_ctl->events[i].cpu, ret);
1044  return PAPI_ESYS;
1045  }
1046 
1047  SUBDBG("read: fd: %2d, tid: %ld, cpu: %d, ret: %d\n",
1048  pe_ctl->events[i].event_fd, (long)pe_ctl->tid,
1049  pe_ctl->events[i].cpu, ret);
1050  SUBDBG("read: %lld\n",papi_pe_buffer[0]);
1051 
1052  pe_ctl->counts[i] = papi_pe_buffer[0];
1053  }
1054  }
1055 
1056 
1057  /* Handle cases where we are using FORMAT_GROUP */
1058  /* We assume only one group leader, in position 0 */
1059 
1060  else {
1061  if (pe_ctl->events[0].group_leader_fd!=-1) {
1062  PAPIERROR("Was expecting group leader");
1063  }
1064 
1065  ret = read( pe_ctl->events[0].event_fd, papi_pe_buffer,
1066  sizeof ( papi_pe_buffer ) );
1067 
1068  if ( ret == -1 ) {
1069  PAPIERROR("read returned an error: ", strerror( errno ));
1070  return PAPI_ESYS;
1071  }
1072 
1073  /* we read 1 64-bit value (number of events) then */
1074  /* num_events more 64-bit values that hold the counts */
1075  if (ret<(signed)((1+pe_ctl->num_events)*sizeof(long long))) {
1076  PAPIERROR("Error! short read");
1077  return PAPI_ESYS;
1078  }
1079 
1080  SUBDBG("read: fd: %2d, tid: %ld, cpu: %d, ret: %d\n",
1081  pe_ctl->events[0].event_fd,
1082  (long)pe_ctl->tid, pe_ctl->events[0].cpu, ret);
1083  {
1084  int j;
1085  for(j=0;j<ret/8;j++) {
1086  SUBDBG("read %d: %lld\n",j,papi_pe_buffer[j]);
1087  }
1088  }
1089 
1090  /* Make sure the kernel agrees with how many events we have */
1091  if (papi_pe_buffer[0]!=pe_ctl->num_events) {
1092  PAPIERROR("Error! Wrong number of events");
1093  return PAPI_ESYS;
1094  }
1095 
1096  /* put the count values in their proper location */
1097  for(i=0;i<pe_ctl->num_events;i++) {
1098  pe_ctl->counts[i] = papi_pe_buffer[1+i];
1099  }
1100  }
1101 
1102 
1103  /* If we disabled the counters due to the sync_read_bug(), */
1104  /* then we need to re-enable them now. */
1105  if (bug_sync_read()) {
1106  if ( pe_ctx->state & PERF_EVENTS_RUNNING ) {
1107  for ( i = 0; i < pe_ctl->num_events; i++ ) {
1108  if ( pe_ctl->events[i].group_leader_fd == -1 ) {
1109  /* this should refresh any overflow counters too */
1110  ret = ioctl( pe_ctl->events[i].event_fd,
1111  PERF_EVENT_IOC_ENABLE, NULL );
1112  if ( ret == -1 ) {
1113  /* Should never happen */
1114  PAPIERROR("ioctl(PERF_EVENT_IOC_ENABLE) returned an error: ",
1115  strerror( errno ));
1116  return PAPI_ESYS;
1117  }
1118  }
1119  }
1120  }
1121  }
1122 
1123  /* point PAPI to the values we read */
1124  *events = pe_ctl->counts;
1125 
1126  SUBDBG("EXIT: *events: %p\n", *events);
1127  return PAPI_OK;
1128 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long counts[PERF_EVENT_MAX_MPX_COUNTERS]
int errno
long long flags
Definition: iozone.c:12330
#define READ_BUFFER_SIZE
Definition: perf_event.c:472
static int bug_format_group(void)
Definition: perf_event.c:195
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
#define PERF_EVENTS_RUNNING
Definition: perf_event.c:59
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
char events[MAX_EVENTS][BUFSIZ]
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
#define PAPI_ESYS
Definition: papi.h:253
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)
unsigned int multiplexed
static int bug_sync_read(void)
Definition: perf_event.c:215
again struct sockaddr sizeof(struct sockaddr_in))
unsigned int inherit
long j
Definition: iozone.c:19135

Here is the call graph for this function:

int _pe_reset ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 875 of file perf_event.c.

876 {
877  int i, ret;
878  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
879 
880  ( void ) ctx; /*unused */
881 
882  /* We need to reset all of the events, not just the group leaders */
883  for( i = 0; i < pe_ctl->num_events; i++ ) {
884  ret = ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_RESET, NULL );
885  if ( ret == -1 ) {
886  PAPIERROR("ioctl(%d, PERF_EVENT_IOC_RESET, NULL) "
887  "returned error, Linux says: %s",
888  pe_ctl->events[i].event_fd, strerror( errno ) );
889  return PAPI_ESYS;
890  }
891  }
892 
893  return PAPI_OK;
894 }
int errno
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
#define PAPI_ESYS
Definition: papi.h:253
void PAPIERROR(char *format,...)

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_shutdown_thread ( hwd_context_t ctx)

Definition at line 861 of file perf_event.c.

862 {
863  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
864 
865  pe_ctx->initialized=0;
866 
867  return PAPI_OK;
868 }
return PAPI_OK
Definition: linux-nvml.c:458
int _pe_start ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 1132 of file perf_event.c.

1133 {
1134  int ret;
1135  int i;
1136  int did_something = 0;
1137  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1138  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
1139 
1140  /* Reset the counters first. Is this necessary? */
1141  ret = _pe_reset( pe_ctx, pe_ctl );
1142  if ( ret ) {
1143  return ret;
1144  }
1145 
1146  /* Enable all of the group leaders */
1147  /* All group leaders have a group_leader_fd of -1 */
1148  for( i = 0; i < pe_ctl->num_events; i++ ) {
1149  if (pe_ctl->events[i].group_leader_fd == -1) {
1150  SUBDBG("ioctl(enable): fd: %d\n", pe_ctl->events[i].event_fd);
1151  ret=ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_ENABLE, NULL) ;
1152 
1153  /* ioctls always return -1 on failure */
1154  if (ret == -1) {
1155  PAPIERROR("ioctl(PERF_EVENT_IOC_ENABLE) failed");
1156  return PAPI_ESYS;
1157  }
1158 
1159  did_something++;
1160  }
1161  }
1162 
1163  if (!did_something) {
1164  PAPIERROR("Did not enable any counters");
1165  return PAPI_EBUG;
1166  }
1167 
1168  pe_ctx->state |= PERF_EVENTS_RUNNING;
1169 
1170  return PAPI_OK;
1171 
1172 }
int _pe_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: perf_event.c:875
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
#define PERF_EVENTS_RUNNING
Definition: perf_event.c:59
#define PAPI_EBUG
Definition: papi.h:257
return PAPI_OK
Definition: linux-nvml.c:458
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
#define PAPI_ESYS
Definition: papi.h:253
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)

Here is the call graph for this function:

int _pe_stop ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 1176 of file perf_event.c.

1177 {
1178  SUBDBG( "ENTER: ctx: %p, ctl: %p\n", ctx, ctl);
1179 
1180  int ret;
1181  int i;
1182  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1183  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
1184 
1185  /* Just disable the group leaders */
1186  for ( i = 0; i < pe_ctl->num_events; i++ ) {
1187  if ( pe_ctl->events[i].group_leader_fd == -1 ) {
1188  ret=ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_DISABLE, NULL);
1189  if ( ret == -1 ) {
1190  PAPIERROR( "ioctl(%d, PERF_EVENT_IOC_DISABLE, NULL) "
1191  "returned error, Linux says: %s",
1192  pe_ctl->events[i].event_fd, strerror( errno ) );
1193  return PAPI_EBUG;
1194  }
1195  }
1196  }
1197 
1198  pe_ctx->state &= ~PERF_EVENTS_RUNNING;
1199 
1200  SUBDBG( "EXIT:\n");
1201  return PAPI_OK;
1202 }
int errno
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
#define PERF_EVENTS_RUNNING
Definition: perf_event.c:59
#define PAPI_EBUG
Definition: papi.h:257
return PAPI_OK
Definition: linux-nvml.c:458
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)

Here is the call graph for this function:

int _pe_write ( hwd_context_t ctx,
hwd_control_state_t ctl,
long long from 
)

Definition at line 900 of file perf_event.c.

902 {
903  ( void ) ctx; /*unused */
904  ( void ) ctl; /*unused */
905  ( void ) from; /*unused */
906  /*
907  * Counters cannot be written. Do we need to virtualize the
908  * counters so that they can be written, or perhaps modify code so that
909  * they can be written? FIXME ?
910  */
911 
912  return PAPI_ENOSUPP;
913 }
#define PAPI_ENOSUPP
Definition: papi.h:269
void
Definition: iozone.c:18627