PAPI  5.3.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   64
 

Functions

int _pe_set_domain (hwd_control_state_t *ctl, int domain)
 
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   64

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 1249 of file perf_event.c.

1250 {
1251  int ret;
1252  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1253  pe_control_t *pe_ctl = NULL;
1254 
1255  switch ( code ) {
1256  case PAPI_MULTIPLEX:
1257  pe_ctl = ( pe_control_t * ) ( option->multiplex.ESI->ctl_state );
1258  ret = check_permissions( pe_ctl->tid, pe_ctl->cpu, pe_ctl->domain,
1259  pe_ctl->granularity,
1260  1, pe_ctl->inherit );
1261  if (ret != PAPI_OK) {
1262  return ret;
1263  }
1264 
1265  /* looks like we are allowed, so set multiplexed attribute */
1266  pe_ctl->multiplexed = 1;
1267  ret = _pe_update_control_state( pe_ctl, NULL,
1268  pe_ctl->num_events, pe_ctx );
1269  if (ret != PAPI_OK) {
1270  pe_ctl->multiplexed = 0;
1271  }
1272  return ret;
1273 
1274  case PAPI_ATTACH:
1275  pe_ctl = ( pe_control_t * ) ( option->attach.ESI->ctl_state );
1276  ret = check_permissions( option->attach.tid, pe_ctl->cpu,
1277  pe_ctl->domain, pe_ctl->granularity,
1278  pe_ctl->multiplexed,
1279  pe_ctl->inherit );
1280  if (ret != PAPI_OK) {
1281  return ret;
1282  }
1283 
1284  pe_ctl->tid = option->attach.tid;
1285 
1286  /* If events have been already been added, something may */
1287  /* have been done to the kernel, so update */
1288  ret =_pe_update_control_state( pe_ctl, NULL,
1289  pe_ctl->num_events, pe_ctx);
1290 
1291  return ret;
1292 
1293  case PAPI_DETACH:
1294  pe_ctl = ( pe_control_t *) ( option->attach.ESI->ctl_state );
1295 
1296  pe_ctl->tid = 0;
1297  return PAPI_OK;
1298 
1299  case PAPI_CPU_ATTACH:
1300  pe_ctl = ( pe_control_t *) ( option->cpu.ESI->ctl_state );
1301  ret = check_permissions( pe_ctl->tid, option->cpu.cpu_num,
1302  pe_ctl->domain, pe_ctl->granularity,
1303  pe_ctl->multiplexed,
1304  pe_ctl->inherit );
1305  if (ret != PAPI_OK) {
1306  return ret;
1307  }
1308  /* looks like we are allowed so set cpu number */
1309 
1310  /* this tells the kernel not to count for a thread */
1311  /* should we warn if we try to set both? perf_event */
1312  /* will reject it. */
1313  pe_ctl->tid = -1;
1314 
1315  pe_ctl->cpu = option->cpu.cpu_num;
1316 
1317  return PAPI_OK;
1318 
1319  case PAPI_DOMAIN:
1320  pe_ctl = ( pe_control_t *) ( option->domain.ESI->ctl_state );
1321  ret = check_permissions( pe_ctl->tid, pe_ctl->cpu,
1322  option->domain.domain,
1323  pe_ctl->granularity,
1324  pe_ctl->multiplexed,
1325  pe_ctl->inherit );
1326  if (ret != PAPI_OK) {
1327  return ret;
1328  }
1329  /* looks like we are allowed, so set counting domain */
1330  return _pe_set_domain( pe_ctl, option->domain.domain );
1331 
1332  case PAPI_GRANUL:
1333  pe_ctl = (pe_control_t *) ( option->granularity.ESI->ctl_state );
1334 
1335  /* FIXME: we really don't support this yet */
1336 
1337  switch ( option->granularity.granularity ) {
1338  case PAPI_GRN_PROCG:
1339  case PAPI_GRN_SYS_CPU:
1340  case PAPI_GRN_PROC:
1341  return PAPI_ECMP;
1342 
1343  /* Currently we only support thread and CPU granularity */
1344  case PAPI_GRN_SYS:
1345  pe_ctl->granularity=PAPI_GRN_SYS;
1346  break;
1347 
1348  case PAPI_GRN_THR:
1349  pe_ctl->granularity=PAPI_GRN_THR;
1350  break;
1351 
1352 
1353  default:
1354  return PAPI_EINVAL;
1355  }
1356  return PAPI_OK;
1357 
1358  case PAPI_INHERIT:
1359  pe_ctl = (pe_control_t *) ( option->inherit.ESI->ctl_state );
1360  ret = check_permissions( pe_ctl->tid, pe_ctl->cpu, pe_ctl->domain,
1361  pe_ctl->granularity, pe_ctl->multiplexed,
1362  option->inherit.inherit );
1363  if (ret != PAPI_OK) {
1364  return ret;
1365  }
1366  /* looks like we are allowed, so set the requested inheritance */
1367  if (option->inherit.inherit) {
1368  /* children will inherit counters */
1369  pe_ctl->inherit = 1;
1370  } else {
1371  /* children won't inherit counters */
1372  pe_ctl->inherit = 0;
1373  }
1374  return PAPI_OK;
1375 
1376  case PAPI_DATA_ADDRESS:
1377  return PAPI_ENOSUPP;
1378 #if 0
1379  pe_ctl = (pe_control_t *) (option->address_range.ESI->ctl_state);
1380  ret = set_default_domain( pe_ctl, option->address_range.domain );
1381  if ( ret != PAPI_OK ) {
1382  return ret;
1383  }
1384  set_drange( pe_ctx, pe_ctl, option );
1385  return PAPI_OK;
1386 #endif
1387  case PAPI_INSTR_ADDRESS:
1388  return PAPI_ENOSUPP;
1389 #if 0
1390  pe_ctl = (pe_control_t *) (option->address_range.ESI->ctl_state);
1391  ret = set_default_domain( pe_ctl, option->address_range.domain );
1392  if ( ret != PAPI_OK ) {
1393  return ret;
1394  }
1395  set_irange( pe_ctx, pe_ctl, option );
1396  return PAPI_OK;
1397 #endif
1398 
1399  case PAPI_DEF_ITIMER:
1400  /* What should we be checking for here? */
1401  /* This seems like it should be OS-specific not component */
1402  /* specific. */
1403 
1404  return PAPI_OK;
1405 
1406  case PAPI_DEF_MPX_NS:
1407  /* Defining a given ns per set is not current supported */
1408  return PAPI_ENOSUPP;
1409 
1410  case PAPI_DEF_ITIMER_NS:
1411  /* We don't support this... */
1412  return PAPI_OK;
1413 
1414  default:
1415  return PAPI_ENOSUPP;
1416  }
1417 }
_papi_int_inherit_t inherit
#define PAPI_GRN_SYS_CPU
Definition: fpapi.h:72
#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
int _pe_set_domain(hwd_control_state_t *ctl, int domain)
Definition: perf_event.c:817
#define PAPI_INSTR_ADDRESS
Definition: papi.h:451
_papi_int_addr_range_t address_range
#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
#define PAPI_GRN_SYS
Definition: fpapi.h:71
#define PAPI_GRN_PROC
Definition: fpapi.h:69
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:380
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:1185
_papi_int_cpu_t cpu
#define PAPI_ENOSUPP
Definition: fpapi.h:123
#define PAPI_GRN_PROCG
Definition: fpapi.h:70
#define PAPI_ECMP
Definition: fpapi.h:109
_papi_int_granularity_t granularity
EventSetInfo_t * ESI
unsigned int multiplexed
#define PAPI_DOMAIN
Definition: fpapi.h:50
#define PAPI_ATTACH
Definition: fpapi.h:62
EventSetInfo_t * ESI
#define PAPI_GRANUL
Definition: fpapi.h:52
_papi_int_multiplex_t multiplex
#define PAPI_DEF_MPX_NS
Definition: fpapi.h:53
#define PAPI_DETACH
Definition: fpapi.h:66
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
EventSetInfo_t * ESI
hwd_control_state_t * ctl_state
#define PAPI_GRN_THR
Definition: fpapi.h:67
#define PAPI_MULTIPLEX
Definition: fpapi.h:48
EventSetInfo_t * ESI

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 911 of file perf_event.c.

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

857 {
858  int i, ret;
859  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
860 
861  ( void ) ctx; /*unused */
862 
863  /* We need to reset all of the events, not just the group leaders */
864  for( i = 0; i < pe_ctl->num_events; i++ ) {
865  ret = ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_RESET, NULL );
866  if ( ret == -1 ) {
867  PAPIERROR("ioctl(%d, PERF_EVENT_IOC_RESET, NULL) "
868  "returned error, Linux says: %s",
869  pe_ctl->events[i].event_fd, strerror( errno ) );
870  return PAPI_ESYS;
871  }
872  }
873 
874  return PAPI_OK;
875 }
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
void PAPIERROR(char *format,...)
#define PAPI_ESYS
Definition: fpapi.h:108

Here is the call graph for this function:

Here is the caller graph for this function:

int _pe_set_domain ( hwd_control_state_t ctl,
int  domain 
)

Definition at line 817 of file perf_event.c.

818 {
819 
820  int i;
821  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
822 
823  SUBDBG("old control domain %d, new domain %d\n",
824  pe_ctl->domain,domain);
825 
826  pe_ctl->domain = domain;
827 
828  /* Force the domain on all events */
829  for( i = 0; i < pe_ctl->num_events; i++ ) {
830  pe_ctl->events[i].attr.exclude_user =
831  !( pe_ctl->domain & PAPI_DOM_USER );
832  pe_ctl->events[i].attr.exclude_kernel =
833  !( pe_ctl->domain & PAPI_DOM_KERNEL );
834  pe_ctl->events[i].attr.exclude_hv =
835  !( pe_ctl->domain & PAPI_DOM_SUPERVISOR );
836  }
837  return PAPI_OK;
838 }
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
unsigned int domain
int i
Definition: fileop.c:140
#define PAPI_DOM_SUPERVISOR
Definition: fpapi.h:24
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
struct perf_event_attr attr
#define PAPI_DOM_USER
Definition: fpapi.h:21

Here is the caller graph for this function:

int _pe_shutdown_thread ( hwd_context_t ctx)

Definition at line 842 of file perf_event.c.

843 {
844  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
845 
846  pe_ctx->initialized=0;
847 
848  return PAPI_OK;
849 }
return PAPI_OK
Definition: linux-nvml.c:458
int _pe_start ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 1110 of file perf_event.c.

1111 {
1112  int ret;
1113  int i;
1114  int did_something = 0;
1115  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1116  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
1117 
1118  /* Reset the counters first. Is this necessary? */
1119  ret = _pe_reset( pe_ctx, pe_ctl );
1120  if ( ret ) {
1121  return ret;
1122  }
1123 
1124  /* Enable all of the group leaders */
1125  /* All group leaders have a group_leader_fd of -1 */
1126  for( i = 0; i < pe_ctl->num_events; i++ ) {
1127  if (pe_ctl->events[i].group_leader_fd == -1) {
1128  SUBDBG("ioctl(enable): fd: %d\n", pe_ctl->events[i].event_fd);
1129  ret=ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_ENABLE, NULL) ;
1130 
1131  /* ioctls always return -1 on failure */
1132  if (ret == -1) {
1133  PAPIERROR("ioctl(PERF_EVENT_IOC_ENABLE) failed.\n");
1134  return PAPI_ESYS;
1135  }
1136 
1137  did_something++;
1138  }
1139  }
1140 
1141  if (!did_something) {
1142  PAPIERROR("Did not enable any counters.\n");
1143  return PAPI_EBUG;
1144  }
1145 
1146  pe_ctx->state |= PERF_EVENTS_RUNNING;
1147 
1148  return PAPI_OK;
1149 
1150 }
int _pe_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: perf_event.c:856
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
#define PERF_EVENTS_RUNNING
Definition: perf_event.c:50
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,...)
#define PAPI_ESYS
Definition: fpapi.h:108
#define PAPI_EBUG
Definition: fpapi.h:111

Here is the call graph for this function:

int _pe_stop ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 1154 of file perf_event.c.

1155 {
1156 
1157  int ret;
1158  int i;
1159  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1160  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
1161 
1162  /* Just disable the group leaders */
1163  for ( i = 0; i < pe_ctl->num_events; i++ ) {
1164  if ( pe_ctl->events[i].group_leader_fd == -1 ) {
1165  ret=ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_DISABLE, NULL);
1166  if ( ret == -1 ) {
1167  PAPIERROR( "ioctl(%d, PERF_EVENT_IOC_DISABLE, NULL) "
1168  "returned error, Linux says: %s",
1169  pe_ctl->events[i].event_fd, strerror( errno ) );
1170  return PAPI_EBUG;
1171  }
1172  }
1173  }
1174 
1175  pe_ctx->state &= ~PERF_EVENTS_RUNNING;
1176 
1177  return PAPI_OK;
1178 }
int errno
pe_event_info_t events[PERF_EVENT_MAX_MPX_COUNTERS]
#define PERF_EVENTS_RUNNING
Definition: perf_event.c:50
return PAPI_OK
Definition: linux-nvml.c:458
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
void PAPIERROR(char *format,...)
#define PAPI_EBUG
Definition: fpapi.h:111

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 881 of file perf_event.c.

883 {
884  ( void ) ctx; /*unused */
885  ( void ) ctl; /*unused */
886  ( void ) from; /*unused */
887  /*
888  * Counters cannot be written. Do we need to virtualize the
889  * counters so that they can be written, or perhaps modify code so that
890  * they can be written? FIXME ?
891  */
892 
893  return PAPI_ENOSUPP;
894 }
void
Definition: iozone.c:18627
#define PAPI_ENOSUPP
Definition: fpapi.h:123