PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
papi_internal.c File Reference
Include dependency graph for papi_internal.c:

Go to the source code of this file.

Data Structures

struct  native_event_info
 

Macros

#define NATIVE_EVENT_CHUNKSIZE   1024
 

Functions

static int default_debug_handler (int errorCode)
 
static long long handle_derived (EventInfo_t *evi, long long *from)
 
void _papi_hwi_set_papi_event_string (const char *event_string)
 
char * _papi_hwi_get_papi_event_string ()
 
void _papi_hwi_free_papi_event_string ()
 
void _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag)
 
unsigned int _papi_hwi_get_papi_event_code ()
 
int _papi_hwi_get_ntv_idx (unsigned int papi_evt_code)
 
static int is_supported_by_component (int cidx, char *event_name)
 
int _papi_hwi_prefix_component_name (char *component_name, char *event_name, char *out, int out_len)
 
char * _papi_hwi_strip_component_prefix (char *event_name)
 
static int _papi_hwi_find_native_event (int cidx, int event, const char *event_name)
 
static int _papi_hwi_add_native_event (int cidx, int ntv_event, int ntv_idx, const char *event_name)
 
static int _papi_hwi_add_error (char *error)
 
static void _papi_hwi_cleanup_errors ()
 
static int _papi_hwi_lookup_error (char *error)
 
int _papi_hwi_publish_error (char *error)
 
void _papi_hwi_init_errors (void)
 
int _papi_hwi_invalid_cmp (int cidx)
 
int _papi_hwi_component_index (int event_code)
 
int _papi_hwi_native_to_eventcode (int cidx, int event_code, int ntv_idx, const char *event_name)
 
int _papi_hwi_eventcode_to_native (int event_code)
 
void PAPIERROR (char *format,...)
 
static int allocate_eventset_map (DynamicArray_t *map)
 
static int expand_dynamic_array (DynamicArray_t *DA)
 
static int EventInfoArrayLength (const EventSetInfo_t *ESI)
 
static int create_EventSet (EventSetInfo_t **here)
 
int _papi_hwi_assign_eventset (EventSetInfo_t *ESI, int cidx)
 
void _papi_hwi_free_EventSet (EventSetInfo_t *ESI)
 
static int add_EventSet (EventSetInfo_t *ESI, ThreadInfo_t *master)
 
int _papi_hwi_create_eventset (int *EventSet, ThreadInfo_t *handle)
 
static int get_free_EventCodeIndex (const EventSetInfo_t *ESI, unsigned int EventCode)
 
int _papi_hwi_lookup_EventCodeIndex (const EventSetInfo_t *ESI, unsigned int EventCode)
 
int _papi_hwi_remove_EventSet (EventSetInfo_t *ESI)
 
static int event_already_in_eventset (EventSetInfo_t *ESI, int papi_event)
 
void _papi_hwi_map_events_to_native (EventSetInfo_t *ESI)
 
static int add_native_fail_clean (EventSetInfo_t *ESI, int nevt)
 
static int update_overflow (EventSetInfo_t *ESI)
 
static int add_native_events (EventSetInfo_t *ESI, unsigned int *nevt, int size, EventInfo_t *out)
 
int _papi_hwi_add_event (EventSetInfo_t *ESI, int EventCode)
 
static int remove_native_events (EventSetInfo_t *ESI, int *nevt, int size)
 
int _papi_hwi_remove_event (EventSetInfo_t *ESI, int EventCode)
 
int _papi_hwi_read (hwd_context_t *context, EventSetInfo_t *ESI, long long *values)
 
int _papi_hwi_cleanup_eventset (EventSetInfo_t *ESI)
 
int _papi_hwi_convert_eventset_to_multiplex (_papi_int_multiplex_t *mpx)
 
int _papi_hwi_init_global (void)
 
int _papi_hwi_init_global_internal (void)
 
void _papi_hwi_shutdown_global_internal (void)
 
void _papi_hwi_dummy_handler (int EventSet, void *address, long long overflow_vector, void *context)
 
static long long handle_derived_add (int *position, long long *from)
 
static long long handle_derived_subtract (int *position, long long *from)
 
static long long units_per_second (long long units, long long cycles)
 
static long long handle_derived_ps (int *position, long long *from)
 
static long long handle_derived_add_ps (int *position, long long *from)
 
static long long _papi_hwi_postfix_calc (EventInfo_t *evi, long long *hw_counter)
 
int _papi_hwi_derived_type (char *tmp, int *code)
 
static int _papi_hwi_derived_string (int type, char *derived, int len)
 
int _papi_hwi_get_preset_event_info (int EventCode, PAPI_event_info_t *info)
 
int _papi_hwi_query_native_event (unsigned int EventCode)
 
int _papi_hwi_native_name_to_code (char *in, int *out)
 
int _papi_hwi_native_code_to_name (unsigned int EventCode, char *hwi_name, int len)
 
int _papi_hwi_get_native_event_info (unsigned int EventCode, PAPI_event_info_t *info)
 
EventSetInfo_t_papi_hwi_lookup_EventSet (int eventset)
 
int _papi_hwi_is_sw_multiplex (EventSetInfo_t *ESI)
 
hwd_context_t_papi_hwi_get_context (EventSetInfo_t *ESI, int *is_dirty)
 

Variables

int init_level = PAPI_NOT_INITED
 
int _papi_hwi_error_level = PAPI_QUIET
 
PAPI_debug_handler_t _papi_hwi_debug_handler = default_debug_handler
 
papi_mdi_t _papi_hwi_system_info
 
int _papi_hwi_errno = PAPI_OK
 
int _papi_hwi_num_errors = 0
 
static struct native_event_info_papi_native_events =NULL
 
static int num_native_events =0
 
static int num_native_chunks =0
 
char ** _papi_errlist = NULL
 
static int num_error_chunks = 0
 
char * papi_event_string = NULL
 
static unsigned int papi_event_code = -1
 
static int papi_event_code_changed = -1
 
int papi_num_components = ( sizeof ( _papi_hwd ) / sizeof ( *_papi_hwd ) ) - 1
 
static const hwi_describe_t _papi_hwi_derived []
 

Macro Definition Documentation

#define NATIVE_EVENT_CHUNKSIZE   1024

Definition at line 65 of file papi_internal.c.

Function Documentation

static int _papi_hwi_add_error ( char *  error)
static

Definition at line 392 of file papi_internal.c.

393 {
394  INTDBG("Adding a new Error message |%s|\n", error);
396 
399  _papi_errlist=realloc(_papi_errlist,
400  num_error_chunks*NATIVE_EVENT_CHUNKSIZE*sizeof(char *));
401  if (_papi_errlist==NULL) {
403  goto bail;
404  }
405 
406  }
407 
408  _papi_errlist[_papi_hwi_num_errors] = strdup( error );
409  if ( _papi_errlist[_papi_hwi_num_errors] == NULL )
411 
412 bail:
414 
415  return _papi_hwi_num_errors++;
416 }
#define INTDBG(format, args...)
Definition: papi_debug.h:65
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 NATIVE_EVENT_CHUNKSIZE
Definition: papi_internal.c:65
static int num_error_chunks
Definition: papi_internal.c:81
int _papi_hwi_num_errors
Definition: papi_internal.c:59
#define INTERNAL_LOCK
Definition: papi_internal.h:85
char ** _papi_errlist
Definition: papi_internal.c:80

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_add_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1299 of file papi_internal.c.

1300 {
1301  int i, j, thisindex, remap, retval = PAPI_OK;
1302  int cidx;
1303 
1304  cidx=_papi_hwi_component_index( EventCode );
1305  if (cidx<0) return PAPI_ENOCMP;
1306 
1307  /* Sanity check that the new EventCode is from the same component */
1308  /* as previous events. */
1309 
1310  if ( ESI->CmpIdx < 0 ) {
1311  if ( ( retval = _papi_hwi_assign_eventset( ESI, cidx)) != PAPI_OK ) {
1312  return retval;
1313  }
1314  } else {
1315  if ( ESI->CmpIdx != cidx ) {
1316  return PAPI_EINVAL;
1317  }
1318  }
1319 
1320  /* Make sure the event is not present and get the next free slot. */
1321  thisindex = get_free_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1322  if ( thisindex < PAPI_OK ) {
1323  return thisindex;
1324  }
1325 
1326  INTDBG("Adding event to slot %d of EventSet %d\n",thisindex,ESI->EventSetIndex);
1327 
1328  /* If it is a software MPX EventSet, add it to the multiplex data structure */
1329  /* and this thread's multiplex list */
1330 
1331  if ( !_papi_hwi_is_sw_multiplex( ESI ) ) {
1332 
1333  /* Handle preset case */
1334  if ( IS_PRESET(EventCode) ) {
1335  int count;
1336  int preset_index = EventCode & ( int ) PAPI_PRESET_AND_MASK;
1337 
1338  /* Check if it's within the valid range */
1339  if ( ( preset_index < 0 ) || ( preset_index >= PAPI_MAX_PRESET_EVENTS ) ) {
1340  return PAPI_EINVAL;
1341  }
1342 
1343  /* count the number of native events in this preset */
1344  count = ( int ) _papi_hwi_presets[preset_index].count;
1345 
1346  /* Check if event exists */
1347  if ( !count ) {
1348  return PAPI_ENOEVNT;
1349  }
1350 
1351  /* check if the native events have been used as overflow events */
1352  /* this is not allowed */
1353  if ( ESI->state & PAPI_OVERFLOWING ) {
1354  for( i = 0; i < count; i++ ) {
1355  for( j = 0; j < ESI->overflow.event_counter; j++ ) {
1356  if ( ESI->overflow.EventCode[j] ==(int)
1357  ( _papi_hwi_presets[preset_index].code[i] ) ) {
1358  return PAPI_ECNFLCT;
1359  }
1360  }
1361  }
1362  }
1363 
1364  /* Try to add the preset. */
1365 
1366  remap = add_native_events( ESI,
1367  _papi_hwi_presets[preset_index].code,
1368  count, &ESI->EventInfoArray[thisindex] );
1369  if ( remap < 0 ) {
1370  return remap;
1371  }
1372  else {
1373  /* Fill in the EventCode (machine independent) information */
1374  ESI->EventInfoArray[thisindex].event_code =
1375  ( unsigned int ) EventCode;
1376  ESI->EventInfoArray[thisindex].derived =
1377  _papi_hwi_presets[preset_index].derived_int;
1378  ESI->EventInfoArray[thisindex].ops =
1379  _papi_hwi_presets[preset_index].postfix;
1380  ESI->NumberOfEvents++;
1382 
1383  }
1384  }
1385  /* Handle adding Native events */
1386  else if ( IS_NATIVE(EventCode) ) {
1387 
1388  /* Check if native event exists */
1389  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) != PAPI_OK ) {
1390  return PAPI_ENOEVNT;
1391  }
1392 
1393  /* check if the native events have been used as overflow events */
1394  /* This is not allowed */
1395  if ( ESI->state & PAPI_OVERFLOWING ) {
1396  for( j = 0; j < ESI->overflow.event_counter; j++ ) {
1397  if ( EventCode == ESI->overflow.EventCode[j] ) {
1398  return PAPI_ECNFLCT;
1399  }
1400  }
1401  }
1402 
1403  /* Try to add the native event. */
1404 
1405  remap = add_native_events( ESI, (unsigned int *)&EventCode, 1,
1406  &ESI->EventInfoArray[thisindex] );
1407 
1408  if ( remap < 0 ) {
1409  return remap;
1410  } else {
1411 
1412  /* Fill in the EventCode (machine independent) information */
1413  ESI->EventInfoArray[thisindex].event_code =
1414  ( unsigned int ) EventCode;
1415  ESI->NumberOfEvents++;
1417 
1418  }
1419  } else if ( IS_USER_DEFINED( EventCode ) ) {
1420  int count;
1421  int index = EventCode & PAPI_UE_AND_MASK;
1422 
1423  if ( index < 0 || index >= (int)_papi_user_events_count )
1424  return ( PAPI_EINVAL );
1425 
1426  count = ( int ) _papi_user_events[index].count;
1427 
1428  for ( i = 0; i < count; i++ ) {
1429  for ( j = 0; j < ESI->overflow.event_counter; j++ ) {
1430  if ( ESI->overflow.EventCode[j] ==
1431  _papi_user_events[index].events[i] ) {
1432  return ( PAPI_EBUG );
1433  }
1434  }
1435  }
1436 
1437  remap = add_native_events( ESI,
1438  (unsigned int*)_papi_user_events[index].events,
1439  count, &ESI->EventInfoArray[thisindex] );
1440 
1441  if ( remap < 0 ) {
1442  return remap;
1443  } else {
1444  ESI->EventInfoArray[thisindex].event_code
1445  = (unsigned int) EventCode;
1446  ESI->EventInfoArray[thisindex].derived
1447  = DERIVED_POSTFIX;
1448  ESI->EventInfoArray[thisindex].ops
1449  = _papi_user_events[index].operation;
1450  ESI->NumberOfEvents++;
1452  }
1453  } else {
1454 
1455  /* not Native, Preset, or User events */
1456 
1457  return PAPI_EBUG;
1458  }
1459  }
1460  else {
1461 
1462  /* Multiplexing is special. See multiplex.c */
1463 
1464  retval = mpx_add_event( &ESI->multiplex.mpx_evset, EventCode,
1465  ESI->domain.domain,
1466  ESI->granularity.granularity );
1467 
1468 
1469  if ( retval < PAPI_OK ) {
1470  return retval;
1471  }
1472 
1473  /* Relevant (???) */
1474  ESI->EventInfoArray[thisindex].event_code = ( unsigned int ) EventCode;
1475  ESI->EventInfoArray[thisindex].derived = NOT_DERIVED;
1476 
1477  ESI->NumberOfEvents++;
1478 
1479  /* event is in the EventInfoArray but not mapped to the NativeEvents */
1480  /* this causes issues if you try to set overflow on the event. */
1481  /* in theory this wouldn't matter anyway. */
1482  }
1483 
1484  /* reinstate the overflows if any */
1485  retval=update_overflow( ESI );
1486 
1487  return retval;
1488 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_OVERFLOWING
Definition: papi.h:376
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
int _papi_hwi_query_native_event(unsigned int EventCode)
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_MAX_PRESET_EVENTS
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
EventSetDomainInfo_t domain
#define PAPI_EBUG
Definition: papi.h:257
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define INTDBG(format, args...)
Definition: papi_debug.h:65
char events[MAX_EVENTS][BUFSIZ]
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define IS_NATIVE(EventCode)
Definition: papi.h:226
#define NOT_DERIVED
Definition: papi_internal.h:69
static int cidx
Definition: event_info.c:40
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
static int update_overflow(EventSetInfo_t *ESI)
#define PAPI_ECNFLCT
Definition: papi.h:259
int mpx_add_event(MPX_EventSet **mpx_events, int EventCode, int domain, int granularity)
Definition: sw_multiplex.c:305
EventInfo_t * EventInfoArray
#define PAPI_ENOCMP
Definition: papi.h:268
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
char operation[USER_EVENT_OPERATION_LEN]
int _papi_hwi_assign_eventset(EventSetInfo_t *ESI, int cidx)
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
int _papi_hwi_component_index(int event_code)
unsigned int event_code
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
user_defined_event_t * _papi_user_events
static int add_native_events(EventSetInfo_t *ESI, unsigned int *nevt, int size, EventInfo_t *out)
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
unsigned int _papi_user_events_count
#define DERIVED_POSTFIX
Definition: papi_internal.h:75
static int get_free_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
void _papi_hwi_map_events_to_native(EventSetInfo_t *ESI)
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

static int _papi_hwi_add_native_event ( int  cidx,
int  ntv_event,
int  ntv_idx,
const char *  event_name 
)
static

Definition at line 347 of file papi_internal.c.

347  {
348  INTDBG("ENTER: cidx: %d, ntv_event: %#x, ntv_idx: %d, event_name: %s\n", cidx, ntv_event, ntv_idx, event_name);
349 
350  int new_native_event;
351 
353 
357  num_native_chunks*NATIVE_EVENT_CHUNKSIZE*
358  sizeof(struct native_event_info));
359  if (_papi_native_events==NULL) {
360  new_native_event=PAPI_ENOMEM;
361  goto native_alloc_early_out;
362  }
363  }
364 
368  if (event_name != NULL) {
370  } else {
372  }
373  new_native_event=num_native_events|PAPI_NATIVE_MASK;
374 
376 
377 native_alloc_early_out:
378 
380 
381  INTDBG("EXIT: new_native_event: %#x, num_native_events: %d\n", new_native_event, num_native_events);
382  return new_native_event;
383 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
#define PAPI_NATIVE_MASK
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:76
#define INTDBG(format, args...)
Definition: papi_debug.h:65
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
static int cidx
Definition: event_info.c:40
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
#define NATIVE_EVENT_CHUNKSIZE
Definition: papi_internal.c:65
static int num_native_chunks
Definition: papi_internal.c:78
#define PAPI_ENOMEM
Definition: papi.h:252
#define INTERNAL_LOCK
Definition: papi_internal.h:85
static int num_native_events
Definition: papi_internal.c:77

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_assign_eventset ( EventSetInfo_t ESI,
int  cidx 
)

Definition at line 734 of file papi_internal.c.

735 {
736  int retval;
737  size_t max_counters;
738  char *ptr;
739  unsigned int i, j;
740 
741  /* If component doesn't exist... */
742  if (_papi_hwi_invalid_cmp(cidx)) return PAPI_ECMP;
743 
744  /* Assigned at create time */
746  ESI->granularity.granularity =
748  ESI->CmpIdx = cidx;
749 
750  /* ??? */
751  max_counters = ( size_t ) _papi_hwd[cidx]->cmp_info.num_mpx_cntrs;
752 
753  ESI->ctl_state = (hwd_control_state_t *) papi_calloc( 1, (size_t)
754  _papi_hwd[cidx]->size.control_state );
755  ESI->sw_stop = (long long *) papi_calloc( ( size_t ) max_counters,
756  sizeof ( long long ) );
757  ESI->hw_start = ( long long * ) papi_calloc( ( size_t ) max_counters,
758  sizeof ( long long ) );
759  ESI->EventInfoArray = ( EventInfo_t * ) papi_calloc( (size_t) max_counters,
760  sizeof ( EventInfo_t ) );
761 
762  /* allocate room for the native events and for the component-private */
763  /* register structures */
764  /* ugh is there a cleaner way to allocate this? vmw */
765  ESI->NativeInfoArray = ( NativeInfo_t * )
766  papi_calloc( ( size_t ) max_counters, sizeof ( NativeInfo_t ));
767 
768  ESI->NativeBits = papi_calloc(( size_t ) max_counters,
769  ( size_t ) _papi_hwd[cidx]->size.reg_value );
770 
771  /* NOTE: the next two malloc allocate blocks of memory that are later */
772  /* parcelled into overflow and profile arrays */
773  ESI->overflow.deadline = ( long long * )
774  papi_malloc( ( sizeof ( long long ) +
775  sizeof ( int ) * 3 ) * ( size_t ) max_counters );
776 
777  ESI->profile.prof = ( PAPI_sprofil_t ** )
778  papi_malloc( ( sizeof ( PAPI_sprofil_t * ) * ( size_t ) max_counters +
779  ( size_t ) max_counters * sizeof ( int ) * 4 ) );
780 
781  /* If any of these allocations failed, free things up and fail */
782 
783  if ( ( ESI->ctl_state == NULL ) ||
784  ( ESI->sw_stop == NULL ) ||
785  ( ESI->hw_start == NULL ) ||
786  ( ESI->NativeInfoArray == NULL ) ||
787  ( ESI->NativeBits == NULL ) ||
788  ( ESI->EventInfoArray == NULL ) ||
789  ( ESI->profile.prof == NULL ) ||
790  ( ESI->overflow.deadline == NULL ) ) {
791 
792  if ( ESI->sw_stop ) papi_free( ESI->sw_stop );
793  if ( ESI->hw_start ) papi_free( ESI->hw_start );
794  if ( ESI->EventInfoArray ) papi_free( ESI->EventInfoArray );
795  if ( ESI->NativeInfoArray ) papi_free( ESI->NativeInfoArray );
796  if ( ESI->NativeBits ) papi_free( ESI->NativeBits );
797  if ( ESI->ctl_state ) papi_free( ESI->ctl_state );
798  if ( ESI->overflow.deadline ) papi_free( ESI->overflow.deadline );
799  if ( ESI->profile.prof ) papi_free( ESI->profile.prof );
800  papi_free( ESI );
801  return PAPI_ENOMEM;
802  }
803 
804 
805  /* Carve up the overflow block into separate arrays */
806  ptr = ( char * ) ESI->overflow.deadline;
807  ptr += sizeof ( long long ) * max_counters;
808  ESI->overflow.threshold = ( int * ) ptr;
809  ptr += sizeof ( int ) * max_counters;
810  ESI->overflow.EventIndex = ( int * ) ptr;
811  ptr += sizeof ( int ) * max_counters;
812  ESI->overflow.EventCode = ( int * ) ptr;
813 
814  /* Carve up the profile block into separate arrays */
815  ptr = ( char * ) ESI->profile.prof +
816  ( sizeof ( PAPI_sprofil_t * ) * max_counters );
817  ESI->profile.count = ( int * ) ptr;
818  ptr += sizeof ( int ) * max_counters;
819  ESI->profile.threshold = ( int * ) ptr;
820  ptr += sizeof ( int ) * max_counters;
821  ESI->profile.EventIndex = ( int * ) ptr;
822  ptr += sizeof ( int ) * max_counters;
823  ESI->profile.EventCode = ( int * ) ptr;
824 
825  /* initialize_EventInfoArray */
826 
827  for ( i = 0; i < max_counters; i++ ) {
828  ESI->EventInfoArray[i].event_code=( unsigned int ) PAPI_NULL;
829  ESI->EventInfoArray[i].ops = NULL;
831  for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
832  ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
833  }
834  }
835 
836  /* initialize_NativeInfoArray */
837  for( i = 0; i < max_counters; i++ ) {
838  ESI->NativeInfoArray[i].ni_event = -1;
839  ESI->NativeInfoArray[i].ni_position = -1;
840  ESI->NativeInfoArray[i].ni_papi_code = -1;
841  ESI->NativeInfoArray[i].ni_owners = 0;
842  ESI->NativeInfoArray[i].ni_bits = ((unsigned char*)ESI->NativeBits) +
844  }
845 
846  ESI->NativeCount = 0;
847 
848  ESI->state = PAPI_STOPPED;
849 
850  /* these used to be init_config */
851  retval = _papi_hwd[cidx]->init_control_state( ESI->ctl_state );
852  retval |= _papi_hwd[cidx]->set_domain( ESI->ctl_state, ESI->domain.domain);
853 
854  return retval;
855 }
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
hwd_register_t * ni_bits
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
int default_granularity
Definition: papi.h:642
#define PAPI_NULL
Definition: papi.h:290
int(* init_control_state)(hwd_control_state_t *ptr)
Definition: papi_vector.h:37
hwd_register_t * NativeBits
EventSetDomainInfo_t domain
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define NOT_DERIVED
Definition: papi_internal.h:69
char *long long size
Definition: iozone.c:12023
static int cidx
Definition: event_info.c:40
PAPI_sprofil_t ** prof
long long
Definition: iozone.c:19827
#define PAPI_ECMP
Definition: papi.h:254
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
#define PAPI_ENOMEM
Definition: papi.h:252
long long * hw_start
int(* set_domain)(hwd_control_state_t *, int)
Definition: papi_vector.h:42
again struct sockaddr sizeof(struct sockaddr_in))
cmp_struct_sizes_t size
Definition: papi_vector.h:23
EventSetGranularityInfo_t granularity
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
long long * sw_stop
int
Definition: iozone.c:18528
unsigned int event_code
#define PAPI_STOPPED
Definition: papi.h:372
int _papi_hwi_invalid_cmp(int cidx)
EventSetProfileInfo_t profile
hwd_control_state_t * ctl_state
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
#define papi_calloc(a, b)
Definition: papi_memory.h:37
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

static void _papi_hwi_cleanup_errors ( )
static

Definition at line 419 of file papi_internal.c.

420 {
421  int i;
422 
423  if ( _papi_errlist == NULL ||
424  _papi_hwi_num_errors == 0 )
425  return;
426 
427 
429  for (i=0; i < _papi_hwi_num_errors; i++ ) {
430  free( _papi_errlist[i]);
431  _papi_errlist[i] = NULL;
432  }
433 
434  free( _papi_errlist );
435  _papi_errlist = NULL;
436  _papi_hwi_num_errors = 0;
438 
440 }
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
static int num_error_chunks
Definition: papi_internal.c:81
int _papi_hwi_num_errors
Definition: papi_internal.c:59
#define INTERNAL_LOCK
Definition: papi_internal.h:85
char ** _papi_errlist
Definition: papi_internal.c:80

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_cleanup_eventset ( EventSetInfo_t ESI)

Definition at line 1711 of file papi_internal.c.

1712 {
1713  int i, j, num_cntrs, retval;
1714  hwd_context_t *context;
1715  int EventCode;
1717  if ( !_papi_hwi_invalid_cmp( ESI->CmpIdx ) ) {
1718  num_cntrs = _papi_hwd[ESI->CmpIdx]->cmp_info.num_mpx_cntrs;
1719 
1720  for(i=0;i<num_cntrs;i++) {
1721 
1722  EventCode=ESI->EventInfoArray[i].event_code;
1723 
1724  /* skip if event not there */
1725  if ( EventCode == PAPI_NULL ) continue;
1726 
1727  /* If it is a MPX EventSet, remove it from the multiplex */
1728  /* data structure and this thread's multiplex list */
1729 
1730  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1731  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1732  if ( retval < PAPI_OK )
1733  return retval;
1734  } else {
1735 
1736  native = ESI->NativeInfoArray;
1737 
1738  /* clear out ESI->NativeInfoArray */
1739  /* do we really need to do this, seeing as we free() it later? */
1740 
1741  for( j = 0; j < ESI->NativeCount; j++ ) {
1742  native[j].ni_event = -1;
1743  native[j].ni_position = -1;
1744  native[j].ni_owners = 0;
1745  /* native[j].ni_bits?? */
1746  }
1747  }
1748 
1749  /* do we really need to do this, seeing as we free() it later? */
1750  ESI->EventInfoArray[i].event_code= ( unsigned int ) PAPI_NULL;
1751  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
1752  ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
1753  }
1754  ESI->EventInfoArray[i].ops = NULL;
1756  }
1757 
1758  context = _papi_hwi_get_context( ESI, NULL );
1759  /* calling with count of 0 equals a close? */
1760  retval = _papi_hwd[ESI->CmpIdx]->update_control_state( ESI->ctl_state,
1761  NULL, 0, context);
1762  if (retval!=PAPI_OK) {
1763  return retval;
1764  }
1765  }
1766 
1767  ESI->CmpIdx = -1;
1768  ESI->NumberOfEvents = 0;
1769  ESI->NativeCount = 0;
1770 
1771  if ( ( ESI->state & PAPI_MULTIPLEXING ) && ESI->multiplex.mpx_evset )
1772  papi_free( ESI->multiplex.mpx_evset );
1773 
1774  if ( ( ESI->state & PAPI_CPU_ATTACH ) && ESI->CpuInfo )
1776 
1777  if ( ESI->ctl_state )
1778  papi_free( ESI->ctl_state );
1779 
1780  if ( ESI->sw_stop )
1781  papi_free( ESI->sw_stop );
1782 
1783  if ( ESI->hw_start )
1784  papi_free( ESI->hw_start );
1785 
1786  if ( ESI->EventInfoArray )
1787  papi_free( ESI->EventInfoArray );
1788 
1789  if ( ESI->NativeInfoArray )
1790  papi_free( ESI->NativeInfoArray );
1791 
1792  if ( ESI->NativeBits )
1793  papi_free( ESI->NativeBits );
1794 
1795  if ( ESI->overflow.deadline )
1796  papi_free( ESI->overflow.deadline );
1797 
1798  if ( ESI->profile.prof )
1799  papi_free( ESI->profile.prof );
1800 
1801  ESI->ctl_state = NULL;
1802  ESI->sw_stop = NULL;
1803  ESI->hw_start = NULL;
1804  ESI->EventInfoArray = NULL;
1805  ESI->NativeInfoArray = NULL;
1806  ESI->NativeBits = NULL;
1807 
1808  memset( &ESI->domain, 0x0, sizeof(EventSetDomainInfo_t) );
1809  memset( &ESI->granularity, 0x0, sizeof(EventSetGranularityInfo_t) );
1810  memset( &ESI->overflow, 0x0, sizeof(EventSetOverflowInfo_t) );
1811  memset( &ESI->multiplex, 0x0, sizeof(EventSetMultiplexInfo_t) );
1812  memset( &ESI->attach, 0x0, sizeof(EventSetAttachInfo_t) );
1813  memset( &ESI->cpu, 0x0, sizeof(EventSetCpuInfo_t) );
1814  memset( &ESI->profile, 0x0, sizeof(EventSetProfileInfo_t) );
1815  memset( &ESI->inherit, 0x0, sizeof(EventSetInheritInfo_t) );
1816 
1817  ESI->CpuInfo = NULL;
1818 
1819  return PAPI_OK;
1820 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
memset(eventId, 0, size)
#define PAPI_CPU_ATTACH
Definition: papi.h:455
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define papi_free(a)
Definition: papi_memory.h:35
#define PAPI_NULL
Definition: papi.h:290
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
EventSetAttachInfo_t attach
#define PAPI_MULTIPLEXING
Definition: papi.h:378
hwd_register_t * NativeBits
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
EventSetInheritInfo_t inherit
struct _CpuInfo * CpuInfo
#define NOT_DERIVED
Definition: papi_internal.h:69
PAPI_sprofil_t ** prof
static int native
Definition: event_info.c:39
int _papi_hwi_shutdown_cpu(CpuInfo_t *cpu)
Definition: cpus.c:306
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
long long * hw_start
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
long long * sw_stop
int mpx_remove_event(MPX_EventSet **mpx_events, int EventCode)
Definition: sw_multiplex.c:418
int
Definition: iozone.c:18528
int(* update_control_state)(hwd_control_state_t *, NativeInfo_t *, int, hwd_context_t *)
Definition: papi_vector.h:38
unsigned int event_code
int _papi_hwi_invalid_cmp(int cidx)
EventSetProfileInfo_t profile
hwd_control_state_t * ctl_state
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
EventSetCpuInfo_t cpu

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_component_index ( int  event_code)

Definition at line 514 of file papi_internal.c.

514  {
515  INTDBG("ENTER: event_code: %#x\n", event_code);
516 
517  int cidx;
518  int event_index;
519 
520  /* currently assume presets are for component 0 only */
521  if (event_code&PAPI_PRESET_MASK) {
522  INTDBG("EXIT: Event %#x is a PRESET, assigning component %d\n", event_code,0);
523  return 0;
524  }
525 
526  event_index=event_code&PAPI_NATIVE_AND_MASK;
527 
528  if ( (event_index < 0) || (event_index>=num_native_events)) {
529  INTDBG("EXIT: Event index %#x is out of range, num_native_events: %d\n", event_index, num_native_events);
530  return PAPI_ENOEVNT;
531  }
532 
533  cidx=_papi_native_events[event_index].cidx;
534 
535  if ((cidx<0) || (cidx >= papi_num_components)) {
536  INTDBG("EXIT: Component index %#x is out of range, papi_num_components: %d\n", cidx, papi_num_components);
537  return PAPI_ENOCMP;
538  }
539 
540  INTDBG("EXIT: Found cidx: %d event_index: %d, event_code: %#x\n", cidx, event_index, event_code);
541  return cidx;
542 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:76
#define PAPI_PRESET_MASK
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
Definition: event_info.c:40
#define PAPI_ENOCMP
Definition: papi.h:268
int papi_num_components
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:77

Here is the caller graph for this function:

int _papi_hwi_convert_eventset_to_multiplex ( _papi_int_multiplex_t mpx)

Definition at line 1823 of file papi_internal.c.

1824 {
1825  int retval, i, j = 0, *mpxlist = NULL;
1826  EventSetInfo_t *ESI = mpx->ESI;
1827  int flags = mpx->flags;
1828 
1829  /* If there are any events in the EventSet,
1830  convert them to multiplex events */
1831 
1832  if ( ESI->NumberOfEvents ) {
1833 
1834  mpxlist =
1835  ( int * ) papi_malloc( sizeof ( int ) *
1836  ( size_t ) ESI->NumberOfEvents );
1837  if ( mpxlist == NULL )
1838  return ( PAPI_ENOMEM );
1839 
1840  /* Build the args to MPX_add_events(). */
1841 
1842  /* Remember the EventInfoArray can be sparse
1843  and the data can be non-contiguous */
1844 
1845  for ( i = 0; i < EventInfoArrayLength( ESI ); i++ )
1846  if ( ESI->EventInfoArray[i].event_code !=
1847  ( unsigned int ) PAPI_NULL )
1848  mpxlist[j++] = ( int ) ESI->EventInfoArray[i].event_code;
1849 
1850  /* Resize the EventInfo_t array */
1851 
1852  if ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex == 0 ) ||
1853  ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) &&
1854  ( flags & PAPI_MULTIPLEX_FORCE_SW ) ) ) {
1855  retval =
1856  MPX_add_events( &ESI->multiplex.mpx_evset, mpxlist, j,
1857  ESI->domain.domain,
1858  ESI->granularity.granularity );
1859  if ( retval != PAPI_OK ) {
1860  papi_free( mpxlist );
1861  return ( retval );
1862  }
1863  }
1864 
1865  papi_free( mpxlist );
1866  }
1867 
1868  /* Update the state before initialization! */
1869 
1870  ESI->state |= PAPI_MULTIPLEXING;
1871  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex &&
1872  ( flags & PAPI_MULTIPLEX_FORCE_SW ) )
1874  ESI->multiplex.ns = ( int ) mpx->ns;
1875 
1876  return ( PAPI_OK );
1877 }
static int EventInfoArrayLength(const EventSetInfo_t *ESI)
long long flags
Definition: iozone.c:12330
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
#define PAPI_NULL
Definition: papi.h:290
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_MULTIPLEXING
Definition: papi.h:378
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:417
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
int MPX_add_events(MPX_EventSet **mpx_events, int *event_list, int num_events, int domain, int granularity)
Definition: sw_multiplex.c:676
int i
Definition: fileop.c:140
unsigned int kernel_multiplex
Definition: papi.h:653
EventInfo_t * EventInfoArray
#define PAPI_ENOMEM
Definition: papi.h:252
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
int
Definition: iozone.c:18528
unsigned int event_code
EventSetInfo_t * ESI
return
Definition: iozone.c:22170
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_create_eventset ( int EventSet,
ThreadInfo_t handle 
)

Definition at line 910 of file papi_internal.c.

911 {
912  EventSetInfo_t *ESI;
913  int retval;
914 
915  /* Is the EventSet already in existence? */
916 
917  if ( ( EventSet == NULL ) || ( handle == NULL ) )
918  return PAPI_EINVAL;
919 
920  if ( *EventSet != PAPI_NULL )
921  return PAPI_EINVAL;
922 
923  /* Well, then allocate a new one. Use n to keep track of a NEW EventSet */
924 
925  retval = create_EventSet( &ESI );
926  if ( retval != PAPI_OK )
927  return retval;
928 
929  ESI->CmpIdx = -1; /* when eventset is created, it is not decided yet which component it belongs to, until first event is added */
930  ESI->state = PAPI_STOPPED;
931 
932  /* Add it to the global table */
933 
934  retval = add_EventSet( ESI, handle );
935  if ( retval < PAPI_OK ) {
937  return retval ;
938  }
939 
940  *EventSet = ESI->EventSetIndex;
941 
942  INTDBG( "(%p,%p): new EventSet in slot %d\n",
943  ( void * ) EventSet, handle, *EventSet );
944 
945  return retval;
946 }
#define PAPI_NULL
Definition: papi.h:290
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_STOPPED
Definition: papi.h:372
void _papi_hwi_free_EventSet(EventSetInfo_t *ESI)
ssize_t retval
Definition: libasync.c:338
static int create_EventSet(EventSetInfo_t **here)
static int add_EventSet(EventSetInfo_t *ESI, ThreadInfo_t *master)

Here is the call graph for this function:

Here is the caller graph for this function:

static int _papi_hwi_derived_string ( int  type,
char *  derived,
int  len 
)
static

Definition at line 2200 of file papi_internal.c.

2201 {
2202  int j;
2203 
2204  for ( j = 0; _papi_hwi_derived[j].value != -1; j++ ) {
2205  if ( _papi_hwi_derived[j].value == type ) {
2206  strncpy( derived, _papi_hwi_derived[j].name, ( size_t )\
2207  len );
2208  return PAPI_OK;
2209  }
2210  }
2211  INTDBG( "Invalid derived type %d\n", type );
2212  return PAPI_EINVAL;
2213 }
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
void double value
Definition: iozone.c:18781
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static const hwi_describe_t _papi_hwi_derived[]
char * name
Definition: iozone.c:23648
long j
Definition: iozone.c:19135

Here is the caller graph for this function:

int _papi_hwi_derived_type ( char *  tmp,
int code 
)

Definition at line 2179 of file papi_internal.c.

2180 {
2181  int i = 0;
2182  while ( _papi_hwi_derived[i].name != NULL ) {
2183  if ( strcasecmp( tmp, _papi_hwi_derived[i].name ) == 0 ) {
2184  *code = _papi_hwi_derived[i].value;
2185  return PAPI_OK;
2186  }
2187  i++;
2188  }
2189  INTDBG( "Invalid derived string %s\n", tmp );
2190  return PAPI_EINVAL;
2191 }
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static const hwi_describe_t _papi_hwi_derived[]
char * name
Definition: iozone.c:23648
long long tmp
Definition: iozone.c:12031

Here is the caller graph for this function:

void _papi_hwi_dummy_handler ( int  EventSet,
void address,
long long  overflow_vector,
void context 
)

Definition at line 1977 of file papi_internal.c.

1979 {
1980  /* This function is not used and shouldn't be called. */
1981  ( void ) EventSet; /*unused */
1982  ( void ) address; /*unused */
1983  ( void ) overflow_vector; /*unused */
1984  ( void ) context; /*unused */
1985  return;
1986 }
int EventSet
Definition: data_range.c:25
void
Definition: iozone.c:18627

Here is the caller graph for this function:

int _papi_hwi_eventcode_to_native ( int  event_code)

Definition at line 569 of file papi_internal.c.

569  {
570  INTDBG("ENTER: event_code: %#x\n", event_code);
571 
572  int result;
573  int event_index;
574 
575  event_index=event_code&PAPI_NATIVE_AND_MASK;
576  if (event_index>=num_native_events) {
577  INTDBG("EXIT: PAPI_ENOEVNT\n");
578  return PAPI_ENOEVNT;
579  }
580 
581  result=_papi_native_events[event_index].component_event;
582 
583  INTDBG("EXIT: result: %#x\n", result);
584  return result;
585 
586 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:76
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:77

Here is the caller graph for this function:

static int _papi_hwi_find_native_event ( int  cidx,
int  event,
const char *  event_name 
)
static

Definition at line 313 of file papi_internal.c.

313  {
314  INTDBG("ENTER: cidx: %x, event: %#x, event_name: %s\n", cidx, event, event_name);
315 
316  int i;
317 
318  // if no event name passed in, it can not be found
319  if (event_name == NULL) {
320  INTDBG("EXIT: PAPI_ENOEVNT\n");
321  return PAPI_ENOEVNT;
322  }
323 
324  for(i=0;i<num_native_events;i++) {
325  // if we have have not set up this event name yet, look at next
326  if (_papi_native_events[i].evt_name == NULL) {
327  continue;
328  }
329 
330  // is this entry for the correct component and event code
331  if ((_papi_native_events[i].cidx==cidx) &&
332  (_papi_native_events[i].component_event==event)) {
333  // if this event name matches what we want, return its papi event code
334  if (strcmp(event_name, _papi_native_events[i].evt_name) == 0) {
335  INTDBG("EXIT: event: %#x, component_event: %#x, ntv_idx: %d, event_name: %s\n",
336  i|PAPI_NATIVE_MASK, _papi_native_events[i].component_event, _papi_native_events[i].ntv_idx, _papi_native_events[i].evt_name);
337  return i|PAPI_NATIVE_MASK;
338  }
339  }
340  }
341 
342  INTDBG("EXIT: PAPI_ENOEVNT\n");
343  return PAPI_ENOEVNT;
344 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_NATIVE_MASK
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:76
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static int cidx
Definition: event_info.c:40
static int num_native_events
Definition: papi_internal.c:77

Here is the caller graph for this function:

void _papi_hwi_free_EventSet ( EventSetInfo_t ESI)

Definition at line 865 of file papi_internal.c.

866 {
868 
869 #ifdef DEBUG
870  memset( ESI, 0x00, sizeof ( EventSetInfo_t ) );
871 #endif
872  papi_free( ESI );
873 
874 }
memset(eventId, 0, size)
#define papi_free(a)
Definition: papi_memory.h:35
int _papi_hwi_cleanup_eventset(EventSetInfo_t *ESI)

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_free_papi_event_string ( )

Definition at line 106 of file papi_internal.c.

106  {
107  if (papi_event_string != NULL) {
109  papi_event_string = NULL;
110  }
111  return;
112 }
char * papi_event_string
Definition: papi_internal.c:87
free(dummyfile[xx])

Here is the call graph for this function:

Here is the caller graph for this function:

hwd_context_t* _papi_hwi_get_context ( EventSetInfo_t ESI,
int is_dirty 
)

Definition at line 2540 of file papi_internal.c.

2541 {
2542  INTDBG("Entry: ESI: %p, is_dirty: %p\n", ESI, is_dirty);
2543  int dirty_ctx;
2544  hwd_context_t *ctx=NULL;
2545 
2546  /* assume for now the control state is clean (last updated by this ESI) */
2547  dirty_ctx = 0;
2548 
2549  /* get a context pointer based on if we are counting for a thread or for a cpu */
2550  if (ESI->state & PAPI_CPU_ATTACHED) {
2551  /* use cpu context */
2552  ctx = ESI->CpuInfo->context[ESI->CmpIdx];
2553 
2554  /* if the user wants to know if the control state was last set by the same event set, tell him */
2555  if (is_dirty != NULL) {
2556  if (ESI->CpuInfo->from_esi != ESI) {
2557  dirty_ctx = 1;
2558  }
2559  *is_dirty = dirty_ctx;
2560  }
2561  ESI->CpuInfo->from_esi = ESI;
2562 
2563  } else {
2564 
2565  /* use thread context */
2566  ctx = ESI->master->context[ESI->CmpIdx];
2567 
2568  /* if the user wants to know if the control state was last set by the same event set, tell him */
2569  if (is_dirty != NULL) {
2570  if (ESI->master->from_esi != ESI) {
2571  dirty_ctx = 1;
2572  }
2573  *is_dirty = dirty_ctx;
2574  }
2575  ESI->master->from_esi = ESI;
2576 
2577  }
2578  return( ctx );
2579 }
#define PAPI_CPU_ATTACHED
Definition: papi.h:380
#define INTDBG(format, args...)
Definition: papi_debug.h:65
struct _CpuInfo * CpuInfo
struct _ThreadInfo * master

Here is the caller graph for this function:

int _papi_hwi_get_native_event_info ( unsigned int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2423 of file papi_internal.c.

2425 {
2426  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2427  int retval;
2428  int cidx;
2429  int nevt_code;
2430 
2431  cidx = _papi_hwi_component_index( EventCode );
2432  if (cidx<0) return PAPI_ENOCMP;
2433 
2434  if (_papi_hwd[cidx]->cmp_info.disabled) return PAPI_ENOCMP;
2435 
2436  if ( EventCode & PAPI_NATIVE_MASK ) {
2437  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2438  _papi_hwi_set_papi_event_code(EventCode, 0);
2439 
2440  /* clear the event info */
2441  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2442  info->event_code = ( unsigned int ) EventCode;
2443 
2444  retval = _papi_hwd[cidx]->ntv_code_to_info(
2445  _papi_hwi_eventcode_to_native(EventCode), info);
2446 
2447  /* If component error, it's missing the ntv_code_to_info vector */
2448  /* so we'll have to fake it. */
2449  if ( retval == PAPI_ECMP ) {
2450 
2451 
2452  INTDBG("missing NTV_CODE_TO_INFO, faking\n");
2453  /* Fill in the info structure */
2454 
2455  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2456  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2457  return nevt_code;
2458  }
2459  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2460  (unsigned int)nevt_code,
2461  info->symbol,
2462  sizeof(info->symbol)) ) == PAPI_OK ) {
2463 
2464  } else {
2465  INTDBG("EXIT: retval: %d\n", retval);
2466  return retval;
2467  }
2468 
2469  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) <0) {
2470  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2471  return nevt_code;
2472  }
2473  retval = _papi_hwd[cidx]->ntv_code_to_descr(
2474  (unsigned int)nevt_code,
2475  info->long_descr,
2476  sizeof ( info->long_descr));
2477  if (retval!=PAPI_OK) {
2478  INTDBG("Failed ntv_code_to_descr()\n");
2479  }
2480 
2481  }
2483  _papi_hwd[cidx]->cmp_info.short_name,
2484  info->symbol,
2485  info->symbol,
2486  sizeof(info->symbol) );
2487 
2488  INTDBG("EXIT: retval: %d\n", retval);
2489  return retval;
2490  }
2491 
2492  INTDBG("EXIT: PAPI_ENOEVNT\n");
2493  return PAPI_ENOEVNT;
2494 }
#define PAPI_ENOEVNT
Definition: papi.h:258
memset(eventId, 0, size)
#define PAPI_NATIVE_MASK
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
return PAPI_OK
Definition: linux-nvml.c:458
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
Definition: event_info.c:40
int(* ntv_code_to_info)(unsigned int, PAPI_event_info_t *)
Definition: papi_vector.h:48
#define PAPI_ECMP
Definition: papi.h:254
again struct sockaddr sizeof(struct sockaddr_in))
#define PAPI_ENOCMP
Definition: papi.h:268
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int
Definition: iozone.c:18528
int _papi_hwi_component_index(int event_code)
int(* ntv_code_to_descr)(unsigned int, char *, int)
Definition: papi_vector.h:46
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
int _papi_hwi_eventcode_to_native(int event_code)
unsigned int event_code
Definition: papi.h:961
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_ntv_idx ( unsigned int  papi_evt_code)

Definition at line 141 of file papi_internal.c.

141  {
142  INTDBG("ENTER: papi_evt_code: %#x\n", papi_evt_code);
143 
144  int result;
145  int event_index;
146 
147  if (papi_evt_code == 0) {
148  INTDBG("EXIT: PAPI_ENOEVNT, invalid papi event code\n");
149  return PAPI_ENOEVNT;
150  }
151 
152  event_index=papi_evt_code&PAPI_NATIVE_AND_MASK;
153  if ((event_index<0) || (event_index>=num_native_events)) {
154  INTDBG("EXIT: PAPI_ENOEVNT, invalid index into native event array\n");
155  return PAPI_ENOEVNT;
156  }
157 
158  result=_papi_native_events[event_index].ntv_idx;
159 
160  INTDBG("EXIT: result: %d\n", result);
161  return result;
162 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:76
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:77

Here is the caller graph for this function:

unsigned int _papi_hwi_get_papi_event_code ( void  )

Definition at line 135 of file papi_internal.c.

135  {
136  INTDBG("papi_event_code: %#x\n", papi_event_code);
137  return papi_event_code;
138 }
static unsigned int papi_event_code
#define INTDBG(format, args...)
Definition: papi_debug.h:65

Here is the caller graph for this function:

char* _papi_hwi_get_papi_event_string ( void  )

Definition at line 101 of file papi_internal.c.

101  {
102  INTDBG("papi_event_string: %s\n", papi_event_string);
103  return papi_event_string;
104 }
char * papi_event_string
Definition: papi_internal.c:87
#define INTDBG(format, args...)
Definition: papi_debug.h:65

Here is the caller graph for this function:

int _papi_hwi_get_preset_event_info ( int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2223 of file papi_internal.c.

2224 {
2225  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2226 
2227  int i = EventCode & PAPI_PRESET_AND_MASK;
2228  unsigned int j;
2229 
2230  if ( _papi_hwi_presets[i].symbol ) { /* if the event is in the preset table */
2231  // since we are setting the whole structure to zero the strncpy calls below will
2232  // be leaving NULL terminates strings as long as they copy 1 less byte than the
2233  // buffer size of the field.
2234  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2235 
2236  info->event_code = ( unsigned int ) EventCode;
2237  strncpy( info->symbol, _papi_hwi_presets[i].symbol,
2238  sizeof(info->symbol)-1);
2239 
2240  if ( _papi_hwi_presets[i].short_descr != NULL )
2241  strncpy( info->short_descr, _papi_hwi_presets[i].short_descr,
2242  sizeof ( info->short_descr )-1 );
2243 
2244  if ( _papi_hwi_presets[i].long_descr != NULL )
2245  strncpy( info->long_descr, _papi_hwi_presets[i].long_descr,
2246  sizeof ( info->long_descr )-1 );
2247 
2249  info->count = _papi_hwi_presets[i].count;
2250 
2252  info->derived, sizeof ( info->derived ) );
2253 
2254  if ( _papi_hwi_presets[i].postfix != NULL )
2255  strncpy( info->postfix, _papi_hwi_presets[i].postfix,
2256  sizeof ( info->postfix )-1 );
2257 
2258  for(j=0;j < info->count; j++) {
2259  info->code[j]=_papi_hwi_presets[i].code[j];
2260  strncpy(info->name[j], _papi_hwi_presets[i].name[j],
2261  sizeof(info->name[j])-1);
2262  }
2263 
2264  if ( _papi_hwi_presets[i].note != NULL ) {
2265  strncpy( info->note, _papi_hwi_presets[i].note,
2266  sizeof ( info->note )-1 );
2267  }
2268 
2269  return PAPI_OK;
2270  } else {
2271  return PAPI_ENOEVNT;
2272  }
2273 }
#define PAPI_ENOEVNT
Definition: papi.h:258
unsigned int count
Definition: papi.h:984
memset(eventId, 0, size)
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
static int _papi_hwi_derived_string(int type, char *derived, int len)
return PAPI_OK
Definition: linux-nvml.c:458
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1010
#define INTDBG(format, args...)
Definition: papi_debug.h:65
unsigned int event_type
Definition: papi_preset.h:30
int i
Definition: fileop.c:140
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:964
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
unsigned int event_type
Definition: papi.h:989
char * short_descr
Definition: papi_preset.h:25
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi.h:1000
again struct sockaddr sizeof(struct sockaddr_in))
char * long_descr
Definition: papi_preset.h:26
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
char * name[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:33
#define PAPI_PRESET_AND_MASK
long j
Definition: iozone.c:19135
unsigned int event_code
Definition: papi.h:961
char * symbol
Definition: papi_preset.h:24
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:992
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:995
unsigned int count
Definition: papi_preset.h:29
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1006
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_init_errors ( void  )

Definition at line 477 of file papi_internal.c.

477  {
478 /* we use add error to avoid the cost of lookups, we know the errors are not there yet */
479  _papi_hwi_add_error("No error");
480  _papi_hwi_add_error("Invalid argument");
481  _papi_hwi_add_error("Insufficient memory");
482  _papi_hwi_add_error("A System/C library call failed");
483  _papi_hwi_add_error("Not supported by component");
484  _papi_hwi_add_error("Access to the counters was lost or interrupted");
485  _papi_hwi_add_error("Internal error, please send mail to the developers");
486  _papi_hwi_add_error("Event does not exist");
487  _papi_hwi_add_error("Event exists, but cannot be counted due to hardware resource limits");
488  _papi_hwi_add_error("EventSet is currently not running");
489  _papi_hwi_add_error("EventSet is currently counting");
490  _papi_hwi_add_error("No such EventSet available");
491  _papi_hwi_add_error("Event in argument is not a valid preset");
492  _papi_hwi_add_error("Hardware does not support performance counters");
493  _papi_hwi_add_error("Unknown error code");
494  _papi_hwi_add_error("Permission level does not permit operation");
495  _papi_hwi_add_error("PAPI hasn't been initialized yet");
496  _papi_hwi_add_error("Component Index isn't set");
497  _papi_hwi_add_error("Not supported");
498  _papi_hwi_add_error("Not implemented");
499  _papi_hwi_add_error("Buffer size exceeded");
500  _papi_hwi_add_error("EventSet domain is not supported for the operation");
501  _papi_hwi_add_error("Invalid or missing event attributes");
502  _papi_hwi_add_error("Too many events or attributes");
503  _papi_hwi_add_error("Bad combination of features");
504 }
static int _papi_hwi_add_error(char *error)

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global ( void  )

Definition at line 1889 of file papi_internal.c.

1890 {
1891  int retval, i = 0;
1892 
1894  if ( retval != PAPI_OK ) {
1895  return retval;
1896  }
1897 
1898  while ( _papi_hwd[i] ) {
1899 
1900  retval = _papi_hwi_innoculate_vector( _papi_hwd[i] );
1901  if ( retval != PAPI_OK ) {
1902  return retval;
1903  }
1904 
1905  /* We can be disabled by user before init */
1906  if (!_papi_hwd[i]->cmp_info.disabled) {
1907  retval = _papi_hwd[i]->init_component( i );
1909 
1910  /* Do some sanity checking */
1911  if (retval==PAPI_OK) {
1912  if (_papi_hwd[i]->cmp_info.num_cntrs >
1914  fprintf(stderr,"Warning! num_cntrs is more than num_mpx_cntrs\n");
1915  }
1916 
1917  }
1918  }
1919 
1920  i++;
1921  }
1922  return PAPI_OK;
1923 }
int _papi_hwi_innoculate_os_vector(papi_os_vector_t *v)
Definition: papi_vector.c:200
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
int i
Definition: fileop.c:140
int _papi_hwi_innoculate_vector(papi_vector_t *v)
Definition: papi_vector.c:109
ssize_t retval
Definition: libasync.c:338
int(* init_component)(int)
Definition: papi_vector.h:35

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global_internal ( void  )

Definition at line 1929 of file papi_internal.c.

1930 {
1931 
1932  int retval;
1933 
1935 
1937 
1938  /* Global struct to maintain EventSet mapping */
1940  if ( retval != PAPI_OK ) {
1941  return retval;
1942  }
1943 
1944  _papi_hwi_system_info.pid = 0; /* Process identifier */
1945 
1946  /* PAPI_hw_info_t struct */
1948 
1949  return PAPI_OK;
1950 }
memset(eventId, 0, size)
int _papi_hwi_using_signal[PAPI_NSIG]
Definition: extras.c:363
Hardware info structure.
Definition: papi.h:777
return PAPI_OK
Definition: linux-nvml.c:458
DynamicArray_t global_eventset_map
static int allocate_eventset_map(DynamicArray_t *map)
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
PAPI_hw_info_t hw_info
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_invalid_cmp ( int  cidx)

Definition at line 507 of file papi_internal.c.

508 {
509  return ( cidx < 0 || cidx >= papi_num_components );
510 }
int papi_num_components

Here is the caller graph for this function:

int _papi_hwi_is_sw_multiplex ( EventSetInfo_t ESI)

Definition at line 2516 of file papi_internal.c.

2517 {
2518  /* Are we multiplexing at all */
2519  if ( ( ESI->state & PAPI_MULTIPLEXING ) == 0 ) {
2520  return 0;
2521  }
2522 
2523  /* Does the component support kernel multiplexing */
2524  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) {
2525  /* Have we forced software multiplexing */
2526  if ( ESI->multiplex.flags == PAPI_MULTIPLEX_FORCE_SW ) {
2527  return 1;
2528  }
2529  /* Nope, using hardware multiplexing */
2530  return 0;
2531  }
2532 
2533  /* We are multiplexing but the component does not support hardware */
2534 
2535  return 1;
2536 
2537 }
#define PAPI_MULTIPLEXING
Definition: papi.h:378
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:417
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
unsigned int kernel_multiplex
Definition: papi.h:653
EventSetMultiplexInfo_t multiplex

Here is the caller graph for this function:

static int _papi_hwi_lookup_error ( char *  error)
static

Definition at line 443 of file papi_internal.c.

444 {
445  int i;
446 
447  for (i=0; i<_papi_hwi_num_errors; i++) {
448  if ( !strncasecmp( _papi_errlist[i], error, strlen( error ) ) )
449  return i;
450 
451  }
452 
453  return (-1);
454 }
int i
Definition: fileop.c:140
int _papi_hwi_num_errors
Definition: papi_internal.c:59
char ** _papi_errlist
Definition: papi_internal.c:80

Here is the caller graph for this function:

int _papi_hwi_lookup_EventCodeIndex ( const EventSetInfo_t ESI,
unsigned int  EventCode 
)

Definition at line 978 of file papi_internal.c.

980 {
981  int i;
982  int limit = EventInfoArrayLength( ESI );
983 
984  for ( i = 0; i < limit; i++ ) {
985  if ( ESI->EventInfoArray[i].event_code == EventCode ) {
986  return i;
987  }
988  }
989 
990  return PAPI_EINVAL;
991 }
static int EventInfoArrayLength(const EventSetInfo_t *ESI)
return PAPI_EINVAL
Definition: linux-nvml.c:408
int i
Definition: fileop.c:140
EventInfo_t * EventInfoArray
unsigned int event_code

Here is the call graph for this function:

Here is the caller graph for this function:

EventSetInfo_t* _papi_hwi_lookup_EventSet ( int  eventset)

Definition at line 2497 of file papi_internal.c.

2498 {
2500  EventSetInfo_t *set;
2501 
2502  if ( ( eventset < 0 ) || ( eventset > map->totalSlots ) )
2503  return ( NULL );
2504 
2505  set = map->dataSlotArray[eventset];
2506 #ifdef DEBUG
2507  if ( ( ISLEVEL( DEBUG_THREADS ) ) && ( _papi_hwi_thread_id_fn ) &&
2508  ( set->master->tid != _papi_hwi_thread_id_fn( ) ) )
2509  return ( NULL );
2510 #endif
2511 
2512  return ( set );
2513 }
DynamicArray_t global_eventset_map
struct _ThreadInfo * master
unsigned long int(* _papi_hwi_thread_id_fn)(void)
Definition: threads.c:42
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
EventSetInfo_t ** dataSlotArray
#define ISLEVEL(a)
Definition: papi_debug.h:54
#define DEBUG_THREADS
Definition: papi_debug.h:30

Here is the caller graph for this function:

void _papi_hwi_map_events_to_native ( EventSetInfo_t ESI)

Definition at line 1058 of file papi_internal.c.

1059 {
1060  INTDBG("ENTER: ESI: %p, ESI->EventInfoArray: %p, ESI->NativeInfoArray: %p, ESI->NumberOfEvents: %d, ESI->NativeCount: %d\n", ESI, ESI->EventInfoArray, ESI->NativeInfoArray, ESI->NumberOfEvents, ESI->NativeCount);
1061 
1062  int i, event, k, n, preset_index = 0, nevt;
1063  int total_events = ESI->NumberOfEvents;
1064 
1065  event = 0;
1066  for( i = 0; i < total_events; i++ ) {
1067 
1068  /* find the first event that isn't PAPI_NULL */
1069  /* Is this really necessary? --vmw */
1070  while ( ESI->EventInfoArray[event].event_code == ( unsigned int ) PAPI_NULL ) {
1071  event++;
1072  }
1073 
1074  /* If it's a preset */
1075  if ( IS_PRESET(ESI->EventInfoArray[event].event_code) ) {
1076  preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_PRESET_AND_MASK;
1077 
1078  /* walk all sub-events in the preset */
1079  for( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
1080  nevt = _papi_hwi_presets[preset_index].code[k];
1081  if ( nevt == PAPI_NULL ) {
1082  break;
1083  }
1084 
1085  INTDBG("Looking for subevent %#x\n",nevt);
1086 
1087  /* Match each sub-event to something in the Native List */
1088  for( n = 0; n < ESI->NativeCount; n++ ) {
1089  if ( nevt == ESI->NativeInfoArray[n].ni_papi_code ) {
1090  INTDBG("Found papi event: %#x, &ESI->NativeInfoArray[%d]: %p, ni_event: %#x, ni_position %d\n",
1091  nevt, n, &(ESI->NativeInfoArray[n]), ESI->NativeInfoArray[n].ni_event, ESI->NativeInfoArray[n].ni_position);
1093  break;
1094  }
1095  }
1096  }
1097  }
1098  /* It's a native event */
1099  else if( IS_NATIVE(ESI->EventInfoArray[event].event_code) ) {
1100  nevt = ( int ) ESI->EventInfoArray[event].event_code;
1101 
1102  // get index into native info array for this event
1103  int nidx = event_already_in_eventset( ESI, nevt );
1104  // if not found, then we need to return an error
1105  if (nidx == PAPI_ENOEVNT) {
1106  INTDBG("EXIT: needed event not found\n");
1107  return;
1108  }
1109  ESI->EventInfoArray[event].pos[0] = ESI->NativeInfoArray[nidx].ni_position;
1110  INTDBG("nidx: %d, ni_position: %d\n", nidx, ESI->NativeInfoArray[nidx].ni_position);
1111 
1112  /* It's a user-defined event */
1113  } else if ( IS_USER_DEFINED(ESI->EventInfoArray[event].event_code) ) {
1114  for ( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
1115  nevt = _papi_user_events[preset_index].events[k];
1116  if ( nevt == PAPI_NULL ) break;
1117 
1118  /* Match each sub-event to something in the Native List */
1119  for ( n = 0; n < ESI->NativeCount; n++ ) {
1120  if ( _papi_hwi_eventcode_to_native(nevt) == ESI->NativeInfoArray[n].ni_event ) {
1122  }
1123  }
1124  }
1125  }
1126  event++;
1127  }
1128 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define PAPI_NULL
Definition: papi.h:290
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static int event_already_in_eventset(EventSetInfo_t *ESI, int papi_event)
#define IS_NATIVE(EventCode)
Definition: papi.h:226
int k
Definition: iozone.c:19136
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
unsigned int event_code
#define PAPI_PRESET_AND_MASK
user_defined_event_t * _papi_user_events
int _papi_hwi_eventcode_to_native(int event_code)
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_native_code_to_name ( unsigned int  EventCode,
char *  hwi_name,
int  len 
)

Definition at line 2385 of file papi_internal.c.

2387 {
2388  INTDBG("ENTER: EventCode: %#x, hwi_name: %p, len: %d\n", EventCode, hwi_name, len);
2389  int cidx;
2390  int retval;
2391  int nevt_code;
2392 
2393  cidx = _papi_hwi_component_index( EventCode );
2394  if (cidx<0) return PAPI_ENOEVNT;
2395 
2396  if ( EventCode & PAPI_NATIVE_MASK ) {
2397  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2398  _papi_hwi_set_papi_event_code(EventCode, 0);
2399 
2400  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2401  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2402  return nevt_code;
2403  }
2404  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2405  (unsigned int)nevt_code,
2406  hwi_name, len) ) == PAPI_OK ) {
2407  retval = _papi_hwi_prefix_component_name( _papi_hwd[cidx]->cmp_info.short_name,
2408  hwi_name, hwi_name, len);
2409  INTDBG("EXIT: retval: %d\n", retval);
2410  return retval;
2411  }
2412  INTDBG("EXIT: retval: %d\n", retval);
2413  return (retval);
2414  }
2415  INTDBG("EXIT: PAPI_ENOEVNT\n");
2416  return PAPI_ENOEVNT;
2417 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_NATIVE_MASK
return PAPI_OK
Definition: linux-nvml.c:458
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
Definition: event_info.c:40
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int _papi_hwi_component_index(int event_code)
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
int _papi_hwi_eventcode_to_native(int event_code)
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_native_name_to_code ( char *  in,
int out 
)

Definition at line 2310 of file papi_internal.c.

2311 {
2312  INTDBG("ENTER: in: %s, out: %p\n", in, out);
2313 
2314  int retval = PAPI_ENOEVNT;
2315  char name[PAPI_HUGE_STR_LEN]; /* make sure it's big enough */
2316  unsigned int i;
2317  int cidx;
2318  char *full_event_name = strdup(in);
2319 
2321 
2322 
2323  for(cidx=0; cidx < papi_num_components; cidx++) {
2324 
2325  if (_papi_hwd[cidx]->cmp_info.disabled) continue;
2326 
2327  // if this component does not support the pmu which defines this event, no need to call it
2328  if (is_supported_by_component(cidx, full_event_name) == 0) continue;
2329 
2330  INTDBG("cidx: %d, name: %s, event: %s\n", cidx, _papi_hwd[cidx]->cmp_info.name, in);
2331 
2332  // show that we do not have an event code yet (the component may create one and update this info)
2333  // this also clears any values left over from a previous call
2335 
2336  /* first check the component for name_to_code */
2337  retval = _papi_hwd[cidx]->ntv_name_to_code( in, ( unsigned * ) out );
2338  if (retval==PAPI_OK) {
2339  *out = _papi_hwi_native_to_eventcode(cidx, *out, -1, in);
2340  free (full_event_name);
2341  INTDBG("EXIT: PAPI_OK event: %s code: %#x\n", in, *out);
2342  return PAPI_OK;
2343  }
2344 
2345  /* If not implemented, work around */
2346  if ( retval==PAPI_ECMP) {
2347  i = 0;
2349 
2350 // _papi_hwi_lock( INTERNAL_LOCK );
2351 
2352  do {
2353  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2355  retval = _papi_hwd[cidx]->ntv_code_to_name(
2356  i,
2357  name, sizeof(name));
2358  /* printf("%#x\nname =|%s|\ninput=|%s|\n", i, name, in); */
2359  if ( retval == PAPI_OK && in != NULL) {
2360  if ( strcasecmp( name, in ) == 0 ) {
2361  *out = _papi_hwi_native_to_eventcode(cidx, i, -1, name);
2362  INTDBG("EXIT: PAPI_OK, event: %s, code: %#x\n", in, *out);
2363  return PAPI_OK;
2364  }
2365  retval = PAPI_ENOEVNT;
2366  } else {
2367  *out = 0;
2368  retval = PAPI_ENOEVNT;
2369  break;
2370  }
2371  } while ( ( _papi_hwd[cidx]->ntv_enum_events( &i, PAPI_ENUM_EVENTS ) == PAPI_OK ) );
2372 
2373 // _papi_hwi_unlock( INTERNAL_LOCK );
2374  }
2375  }
2376 
2377  free (full_event_name);
2378  INTDBG("EXIT: retval: %d\n", retval);
2379  return retval;
2380 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static int is_supported_by_component(int cidx, char *event_name)
int(* ntv_code_to_name)(unsigned int, char *, int)
Definition: papi_vector.h:45
return PAPI_OK
Definition: linux-nvml.c:458
papi_vector_t * _papi_hwd[]
#define PAPI_HUGE_STR_LEN
Definition: papi.h:465
#define INTDBG(format, args...)
Definition: papi_debug.h:65
char * _papi_hwi_strip_component_prefix(char *event_name)
int i
Definition: fileop.c:140
int _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char *event_name)
free(dummyfile[xx])
static int cidx
Definition: event_info.c:40
#define PAPI_ECMP
Definition: papi.h:254
goto out
Definition: pscanf.h:20
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int papi_num_components
int(* ntv_enum_events)(unsigned int *, int)
Definition: papi_vector.h:43
char * name
Definition: iozone.c:23648
int(* ntv_name_to_code)(char *, unsigned int *)
Definition: papi_vector.h:44
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_native_to_eventcode ( int  cidx,
int  event_code,
int  ntv_idx,
const char *  event_name 
)

Definition at line 546 of file papi_internal.c.

546  {
547  INTDBG("Entry: cidx: %d, event: %#x, ntv_idx: %d, event_name: %s\n", cidx, event_code, ntv_idx, event_name);
548 
549  int result;
550 
551  if (papi_event_code_changed > 0) {
553  INTDBG("EXIT: papi_event_code: %#x set by the component\n", result);
554  return result;
555  }
556 
557  result=_papi_hwi_find_native_event(cidx, event_code, event_name);
558  if (result==PAPI_ENOEVNT) {
559  // Need to create one
560  result=_papi_hwi_add_native_event(cidx, event_code, ntv_idx, event_name);
561  }
562 
563  INTDBG("EXIT: result: %#x\n", result);
564  return result;
565 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
#define PAPI_ENOEVNT
Definition: papi.h:258
unsigned int _papi_hwi_get_papi_event_code()
static int _papi_hwi_find_native_event(int cidx, int event, const char *event_name)
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
Definition: event_info.c:40
static int _papi_hwi_add_native_event(int cidx, int ntv_event, int ntv_idx, const char *event_name)
static int papi_event_code_changed

Here is the call graph for this function:

Here is the caller graph for this function:

static long long _papi_hwi_postfix_calc ( EventInfo_t evi,
long long hw_counter 
)
static

Definition at line 2051 of file papi_internal.c.

2052 {
2053  char *point = evi->ops, operand[16];
2054  double stack[PAPI_EVENTS_IN_DERIVED_EVENT];
2055  int i, top = 0;
2056 
2057  memset(&stack,0,PAPI_EVENTS_IN_DERIVED_EVENT*sizeof(double));
2058 
2059  while ( *point != '\0' ) {
2060  if ( *point == 'N' ) { /* to get count for each native event */
2061  i = 0;
2062  point++;
2063  do {
2064  operand[i] = *point;
2065  point++;
2066  i++;
2067  } while ( *point != '|' );
2068  operand[i] = '\0';
2069  stack[top] = ( double ) hw_counter[evi->pos[atoi( operand )]];
2070  top++;
2071  point++;
2072  } else if ( *point == '#' ) { /* to get mhz, ignore the rest char's */
2073  stack[top] = _papi_hwi_system_info.hw_info.cpu_max_mhz * 1000000.0;
2074  top++;
2075  do {
2076  point++;
2077  } while ( *point != '|' );
2078  point++;
2079  } else if ( isdigit( *point ) ) { /* to get integer, I suppose only integer will be used,
2080  no error check here, please only use integer */
2081  i = 0;
2082  do {
2083  operand[i] = *point;
2084  point++;
2085  i++;
2086  } while ( *point != '|' );
2087  operand[i] = '\0';
2088  stack[top] = atoi( operand );
2089  top++;
2090  point++;
2091  } else if ( *point == '+' ) { /* + calculation */
2092  stack[top - 2] += stack[top - 1];
2093  top--;
2094  do {
2095  point++;
2096  } while ( *point != '|' );
2097  point++;
2098  } else if ( *point == '-' ) { /* - calculation */
2099  stack[top - 2] -= stack[top - 1];
2100  top--;
2101  do {
2102  point++;
2103  } while ( *point != '|' );
2104  point++;
2105  } else if ( *point == '*' ) { /* * calculation */
2106  stack[top - 2] *= stack[top - 1];
2107  top--;
2108  do {
2109  point++;
2110  } while ( *point != '|' );
2111  point++;
2112  } else if ( *point == '/' ) { /* / calculation */
2113  stack[top - 2] /= stack[top - 1];
2114  top--;
2115  do {
2116  point++;
2117  } while ( *point != '|' );
2118  point++;
2119  } else { /* do nothing */
2120  do {
2121  point++;
2122  } while ( *point != '|' );
2123  point++;
2124  }
2125  }
2126  return ( long long ) stack[0];
2127 }
int atoi()
memset(eventId, 0, size)
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
static double
Definition: fileop.c:1281
int i
Definition: fileop.c:140
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
PAPI_hw_info_t hw_info
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
int cpu_max_mhz
Definition: papi.h:793

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_prefix_component_name ( char *  component_name,
char *  event_name,
char *  out,
int  out_len 
)

Definition at line 243 of file papi_internal.c.

244 {
245  int size1, size2;
246  char temp[out_len];
247 
248  size1 = strlen(event_name);
249  size2 = strlen(component_name);
250 
251 /* sanity checks */
252  if ( size1 == 0 ) {
253  return (PAPI_EBUG); /* hopefully event_name always has length?! */
254  }
255 
256  if ( size1 >= out_len )
257  return (PAPI_ENOMEM);
258 
259 /* Guard against event_name == out */
260  memcpy( temp, event_name, out_len );
261 
262 /* no component name to prefix */
263  if ( size2 == 0 ) {
264  sprintf(out, "%s%c", temp, '\0' );
265  return (PAPI_OK);
266  }
267 
268 /* Don't prefix 'cpu' component names for now */
269  if ( strstr(component_name, "pe") ||
270  strstr(component_name, "bgq") ||
271  strstr(component_name, "bgp") ) {
272  sprintf( out, "%s%c", temp, '\0');
273  return (PAPI_OK);
274  }
275 
276 /* strlen(component_name) + ::: + strlen(event_name) + NULL */
277  if ( size1+size2+3+1 > out_len )
278  return (PAPI_ENOMEM);
279 
280  sprintf( out, "%s:::%s%c" , component_name, temp, '\0');
281  return (PAPI_OK);
282 }
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")
#define PAPI_EBUG
Definition: papi.h:257
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_ENOMEM
Definition: papi.h:252
goto out
Definition: pscanf.h:20
int temp
Definition: iozone.c:22158
size1
Definition: iozone.c:12039

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_publish_error ( char *  error)

Definition at line 466 of file papi_internal.c.

467 {
468  int error_code = -1;
469 
470  if ( (error_code = _papi_hwi_lookup_error( error )) < 0 )
471  error_code = _papi_hwi_add_error(error);
472 
473  return (-error_code); /* internally error_code is an index, externally, it should be <= 0 */
474 }
static int _papi_hwi_add_error(char *error)
static int _papi_hwi_lookup_error(char *error)

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_query_native_event ( unsigned int  EventCode)

Definition at line 2279 of file papi_internal.c.

2280 {
2281  INTDBG("ENTER: EventCode: %#x\n", EventCode);
2282  char name[PAPI_HUGE_STR_LEN]; /* probably overkill, */
2283  /* but should always be big enough */
2284  int cidx;
2285  int nevt_code;
2286 
2287  cidx = _papi_hwi_component_index( EventCode );
2288  if (cidx<0) {
2289  INTDBG("EXIT: PAPI_ENOCMP\n");
2290  return PAPI_ENOCMP;
2291  }
2292 
2293  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2294  _papi_hwi_set_papi_event_code(EventCode, 0);
2295 
2296  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2297  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2298  return nevt_code;
2299  }
2300  int ret = _papi_hwd[cidx]->ntv_code_to_name( (unsigned int)nevt_code, name, sizeof(name));
2301 
2302  INTDBG("EXIT: ret: %d\n", ret);
2303  return (ret);
2304 }
int(* ntv_code_to_name)(unsigned int, char *, int)
Definition: papi_vector.h:45
papi_vector_t * _papi_hwd[]
#define PAPI_HUGE_STR_LEN
Definition: papi.h:465
#define INTDBG(format, args...)
Definition: papi_debug.h:65
long long ret
Definition: iozone.c:1346
static int cidx
Definition: event_info.c:40
#define PAPI_ENOCMP
Definition: papi.h:268
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
char * name
Definition: iozone.c:23648
int _papi_hwi_component_index(int event_code)
int _papi_hwi_eventcode_to_native(int event_code)

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_read ( hwd_context_t context,
EventSetInfo_t ESI,
long long values 
)

Definition at line 1661 of file papi_internal.c.

1663 {
1664  int retval;
1665  long long *dp = NULL;
1666  int i, index;
1667 
1668  retval = _papi_hwd[ESI->CmpIdx]->read( context, ESI->ctl_state,
1669  &dp, ESI->state );
1670  if ( retval != PAPI_OK ) {
1671  return retval;
1672  }
1673 
1674  /* This routine distributes hardware counters to software counters in the
1675  order that they were added. Note that the higher level
1676  EventInfoArray[i] entries may not be contiguous because the user
1677  has the right to remove an event.
1678  But if we do compaction after remove event, this function can be
1679  changed.
1680  */
1681 
1682  for ( i = 0; i != ESI->NumberOfEvents; i++ ) {
1683 
1684  index = ESI->EventInfoArray[i].pos[0];
1685 
1686  if ( index == -1 )
1687  continue;
1688 
1689  INTDBG( "ESI->EventInfoArray: %p, pos[%d]: %d, dp[%d]: %lld\n", ESI->EventInfoArray, i, index, index, dp[index] );
1690 
1691  /* If this is not a derived event */
1692 
1693  if ( ESI->EventInfoArray[i].derived == NOT_DERIVED ) {
1694  values[i] = dp[index];
1695  INTDBG( "value: %#llx\n", values[i] );
1696  } else { /* If this is a derived event */
1697  values[i] = handle_derived( &ESI->EventInfoArray[i], dp );
1698 #ifdef DEBUG
1699  if ( values[i] < ( long long ) 0 ) {
1700  INTDBG( "Derived Event is negative!!: %lld\n", values[i] );
1701  }
1702  INTDBG( "derived value: %#llx \n", values[i] );
1703 #endif
1704  }
1705  }
1706 
1707  return PAPI_OK;
1708 }
int(* read)(hwd_context_t *, hwd_control_state_t *, long long **, int)
Definition: papi_vector.h:30
return PAPI_OK
Definition: linux-nvml.c:458
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
#define NOT_DERIVED
Definition: papi_internal.h:69
EventInfo_t * EventInfoArray
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
static long long handle_derived(EventInfo_t *evi, long long *from)
hwd_control_state_t * ctl_state
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1576 of file papi_internal.c.

1577 {
1578  int j = 0, retval, thisindex;
1579  EventInfo_t *array;
1580 
1581  thisindex =
1582  _papi_hwi_lookup_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1583  if ( thisindex < PAPI_OK )
1584  return ( thisindex );
1585 
1586  /* If it is a MPX EventSet, remove it from the multiplex data structure and
1587  this threads multiplex list */
1588 
1589  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1590  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1591  if ( retval < PAPI_OK )
1592  return ( retval );
1593  } else
1594  /* Remove the events hardware dependent stuff from the EventSet */
1595  {
1596  if ( IS_PRESET(EventCode) ) {
1597  int preset_index = EventCode & PAPI_PRESET_AND_MASK;
1598 
1599  /* Check if it's within the valid range */
1600  if ( ( preset_index < 0 ) ||
1601  ( preset_index >= PAPI_MAX_PRESET_EVENTS ) )
1602  return PAPI_EINVAL;
1603 
1604  /* Check if event exists */
1605  if ( !_papi_hwi_presets[preset_index].count )
1606  return PAPI_ENOEVNT;
1607 
1608  /* Remove the preset event. */
1609  for ( j = 0; _papi_hwi_presets[preset_index].code[j] != (unsigned int)PAPI_NULL;
1610  j++ );
1612  (int *)_papi_hwi_presets[preset_index].code, j );
1613  if ( retval != PAPI_OK )
1614  return ( retval );
1615  } else if ( IS_NATIVE(EventCode) ) {
1616  /* Check if native event exists */
1617  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) !=
1618  PAPI_OK )
1619  return PAPI_ENOEVNT;
1620 
1621  /* Remove the native event. */
1622  retval = remove_native_events( ESI, &EventCode, 1 );
1623  if ( retval != PAPI_OK )
1624  return ( retval );
1625  } else if ( IS_USER_DEFINED( EventCode ) ) {
1626  int index = EventCode & PAPI_UE_AND_MASK;
1627 
1628  if ( (index < 0) || (index >= (int)_papi_user_events_count) )
1629  return ( PAPI_EINVAL );
1630 
1631  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT &&
1632  _papi_user_events[index].events[j] != 0; j++ ) {
1634  _papi_user_events[index].events, j);
1635 
1636  if ( retval != PAPI_OK )
1637  return ( retval );
1638  }
1639  } else
1640  return ( PAPI_ENOEVNT );
1641  }
1642  array = ESI->EventInfoArray;
1643 
1644  /* Compact the Event Info Array list if it's not the last event */
1645  /* clear the newly empty slot in the array */
1646  for ( ; thisindex < ESI->NumberOfEvents - 1; thisindex++ )
1647  array[thisindex] = array[thisindex + 1];
1648 
1649 
1650  array[thisindex].event_code = ( unsigned int ) PAPI_NULL;
1651  for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ )
1652  array[thisindex].pos[j] = PAPI_NULL;
1653  array[thisindex].ops = NULL;
1654  array[thisindex].derived = NOT_DERIVED;
1655  ESI->NumberOfEvents--;
1656 
1657  return ( PAPI_OK );
1658 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_ENOEVNT
Definition: papi.h:258
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
int _papi_hwi_query_native_event(unsigned int EventCode)
#define PAPI_NULL
Definition: papi.h:290
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_MAX_PRESET_EVENTS
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:408
char events[MAX_EVENTS][BUFSIZ]
#define IS_NATIVE(EventCode)
Definition: papi.h:226
#define NOT_DERIVED
Definition: papi_internal.h:69
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
int _papi_hwi_lookup_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
EventInfo_t * EventInfoArray
static int remove_native_events(EventSetInfo_t *ESI, int *nevt, int size)
EventSetMultiplexInfo_t multiplex
int mpx_remove_event(MPX_EventSet **mpx_events, int EventCode)
Definition: sw_multiplex.c:418
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
unsigned int event_code
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
user_defined_event_t * _papi_user_events
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_EventSet ( EventSetInfo_t ESI)

Definition at line 996 of file papi_internal.c.

997 {
999  int i;
1000 
1001  i = ESI->EventSetIndex;
1002 
1004 
1005  _papi_hwi_free_EventSet( ESI );
1006 
1007  /* do bookkeeping for PAPI_EVENTSET_MAP */
1008 
1009  map->dataSlotArray[i] = NULL;
1010  map->availSlots++;
1011  map->fullSlots--;
1012 
1014 
1015  return PAPI_OK;
1016 }