PAPI  5.3.2.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 1253 of file perf_event.c.

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

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

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

822 {
823 
824  int i;
825  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
826 
827  SUBDBG("old control domain %d, new domain %d\n",
828  pe_ctl->domain,domain);
829 
830  pe_ctl->domain = domain;
831 
832  /* Force the domain on all events */
833  for( i = 0; i < pe_ctl->num_events; i++ ) {
834  pe_ctl->events[i].attr.exclude_user =
835  !( pe_ctl->domain & PAPI_DOM_USER );
836  pe_ctl->events[i].attr.exclude_kernel =
837  !( pe_ctl->domain & PAPI_DOM_KERNEL );
838  pe_ctl->events[i].attr.exclude_hv =
839  !( pe_ctl->domain & PAPI_DOM_SUPERVISOR );
840  }
841  return PAPI_OK;
842 }
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 846 of file perf_event.c.

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

Definition at line 1114 of file perf_event.c.

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

1159 {
1160 
1161  int ret;
1162  int i;
1163  pe_context_t *pe_ctx = ( pe_context_t *) ctx;
1164  pe_control_t *pe_ctl = ( pe_control_t *) ctl;
1165 
1166  /* Just disable the group leaders */
1167  for ( i = 0; i < pe_ctl->num_events; i++ ) {
1168  if ( pe_ctl->events[i].group_leader_fd == -1 ) {
1169  ret=ioctl( pe_ctl->events[i].event_fd, PERF_EVENT_IOC_DISABLE, NULL);
1170  if ( ret == -1 ) {
1171  PAPIERROR( "ioctl(%d, PERF_EVENT_IOC_DISABLE, NULL) "
1172  "returned error, Linux says: %s",
1173  pe_ctl->events[i].event_fd, strerror( errno ) );
1174  return PAPI_EBUG;
1175  }
1176  }
1177  }
1178 
1179  pe_ctx->state &= ~PERF_EVENTS_RUNNING;
1180 
1181  return PAPI_OK;
1182 }
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 885 of file perf_event.c.

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