PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
The Low Level API

Functions

int PAPI_accum (int EventSet, long long *values)
 
int PAPI_add_event (int EventSet, int Event)
 
int PAPI_add_named_event (int EventSet, char *EventName)
 
int PAPI_add_events (int EventSet, int *Events, int number)
 
int PAPI_assign_eventset_component (int EventSet, int cidx)
 
int PAPI_attach (int EventSet, unsigned long tid)
 
int PAPI_cleanup_eventset (int EventSet)
 
int PAPI_create_eventset (int *EventSet)
 
int PAPI_detach (int EventSet)
 
int PAPI_destroy_eventset (int *EventSet)
 
int PAPI_enum_event (int *EventCode, int modifier)
 
int PAPI_enum_cmp_event (int *EventCode, int modifier, int cidx)
 
int PAPI_event_code_to_name (int EventCode, char *out)
 
int PAPI_event_name_to_code (char *in, int *out)
 
int PAPI_get_dmem_info (PAPI_dmem_info_t *dest)
 
int PAPI_get_event_info (int EventCode, PAPI_event_info_t *info)
 
const PAPI_exe_info_tPAPI_get_executable_info (void)
 
const PAPI_hw_info_tPAPI_get_hardware_info (void)
 
const PAPI_component_info_tPAPI_get_component_info (int cidx)
 
int PAPI_get_multiplex (int EventSet)
 
int PAPI_get_opt (int option, PAPI_option_t *ptr)
 
int PAPI_get_cmp_opt (int option, PAPI_option_t *ptr, int cidx)
 
long long PAPI_get_real_cyc (void)
 
long long PAPI_get_real_nsec (void)
 
long long PAPI_get_real_usec (void)
 
const PAPI_shlib_info_tPAPI_get_shared_lib_info (void)
 
int PAPI_get_thr_specific (int tag, void **ptr)
 
int PAPI_get_overflow_event_index (int Eventset, long long overflow_vector, int *array, int *number)
 
long long PAPI_get_virt_cyc (void)
 
long long PAPI_get_virt_nsec (void)
 
long long PAPI_get_virt_usec (void)
 
int PAPI_is_initialized (void)
 
int PAPI_library_init (int version)
 
int PAPI_list_events (int EventSet, int *Events, int *number)
 
int PAPI_list_threads (unsigned long *tids, int *number)
 
int PAPI_lock (int)
 
int PAPI_multiplex_init (void)
 
int PAPI_num_cmp_hwctrs (int cidx)
 
int PAPI_num_events (int EventSet)
 
int PAPI_overflow (int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler)
 
void PAPI_perror (char *msg)
 
int PAPI_profil (void *buf, unsigned bufsiz, caddr_t offset, unsigned scale, int EventSet, int EventCode, int threshold, int flags)
 
int PAPI_query_event (int EventCode)
 
int PAPI_query_named_event (char *EventName)
 
int PAPI_read (int EventSet, long long *values)
 
int PAPI_read_ts (int EventSet, long long *values, long long *cyc)
 
int PAPI_register_thread (void)
 
int PAPI_remove_event (int EventSet, int EventCode)
 
int PAPI_remove_named_event (int EventSet, char *EventName)
 
int PAPI_remove_events (int EventSet, int *Events, int number)
 
int PAPI_reset (int EventSet)
 
int PAPI_set_debug (int level)
 
int PAPI_set_cmp_domain (int domain, int cidx)
 
int PAPI_set_domain (int domain)
 
int PAPI_set_cmp_granularity (int granularity, int cidx)
 
int PAPI_set_granularity (int granularity)
 
int PAPI_set_multiplex (int EventSet)
 
int PAPI_set_opt (int option, PAPI_option_t *ptr)
 
int PAPI_set_thr_specific (int tag, void *ptr)
 
void PAPI_shutdown (void)
 
int PAPI_sprofil (PAPI_sprofil_t *prof, int profcnt, int EventSet, int EventCode, int threshold, int flags)
 
int PAPI_start (int EventSet)
 
int PAPI_state (int EventSet, int *status)
 
int PAPI_stop (int EventSet, long long *values)
 
char * PAPI_strerror (int)
 
unsigned long PAPI_thread_id (void)
 
int PAPI_thread_init (unsigned long(*id_fn)(void))
 
int PAPI_unlock (int)
 
int PAPI_unregister_thread (void)
 
int PAPI_write (int EventSet, long long *values)
 
int PAPI_get_event_component (int EventCode)
 
int PAPI_get_eventset_component (int EventSet)
 
int PAPI_get_component_index (char *name)
 
int PAPI_disable_component (int cidx)
 
int PAPI_disable_component_by_name (char *name)
 

Detailed Description

Function Documentation

int PAPI_accum ( int  EventSet,
long long values 
)

accumulate and reset hardware events from an event set

Definition at line 2662 of file papi.c.

2663 {
2664  EventSetInfo_t *ESI;
2665  hwd_context_t *context;
2666  int i, cidx, retval;
2667  long long a, b, c;
2668 
2670  if ( ESI == NULL )
2672 
2673  cidx = valid_ESI_component( ESI );
2674  if ( cidx < 0 )
2675  papi_return( cidx );
2676 
2677  if ( values == NULL )
2679 
2680  if ( ESI->state & PAPI_RUNNING ) {
2681  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2682  retval = MPX_read( ESI->multiplex.mpx_evset, ESI->sw_stop, 0 );
2683  } else {
2684  /* get the context we should use for this event set */
2685  context = _papi_hwi_get_context( ESI, NULL );
2686  retval = _papi_hwi_read( context, ESI, ESI->sw_stop );
2687  }
2688  if ( retval != PAPI_OK )
2689  papi_return( retval );
2690  }
2691 
2692  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2693  a = ESI->sw_stop[i];
2694  b = values[i];
2695  c = a + b;
2696  values[i] = c;
2697  }
2698 
2700 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
int PAPI_reset(int EventSet)
Definition: papi.c:2377
#define papi_return(a)
Definition: papi.c:47
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_RUNNING
Definition: fpapi.h:30
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
double c
Definition: multiplex.c:22
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
int MPX_read(MPX_EventSet *mpx_events, long long *values, int called_by_stop)
Definition: sw_multiplex.c:823
int i
Definition: fileop.c:140
#define PAPI_ENOEVST
Definition: fpapi.h:116
static int cidx
Definition: event_info.c:40
int _papi_hwi_read(hwd_context_t *context, EventSetInfo_t *ESI, long long *values)
inline_static int valid_ESI_component(EventSetInfo_t *ESI)
Definition: papi.c:89
EventSetMultiplexInfo_t multiplex
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
int EventSet
long long * sw_stop
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
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_add_event ( int  EventSet,
int  Event 
)

add single PAPI preset or native hardware event to an event set

Definition at line 1604 of file papi.c.

1605 {
1606  APIDBG("Entry: EventSet: %d, EventCode: %#x\n", EventSet, EventCode);
1607  EventSetInfo_t *ESI;
1608 
1609  /* Is the EventSet already in existence? */
1610 
1612  if ( ESI == NULL )
1614 
1615  /* Check argument for validity */
1616 
1617  if ( ( ( EventCode & PAPI_PRESET_MASK ) == 0 ) &&
1618  ( EventCode & PAPI_NATIVE_MASK ) == 0 )
1620 
1621  /* Of course, it must be stopped in order to modify it. */
1622 
1623  if ( ESI->state & PAPI_RUNNING )
1625 
1626  /* Now do the magic. */
1627 
1628  papi_return( _papi_hwi_add_event( ESI, EventCode ) );
1629 }
#define PAPI_NATIVE_MASK
#define papi_return(a)
Definition: papi.c:47
#define PAPI_EISRUN
Definition: fpapi.h:115
#define PAPI_RUNNING
Definition: fpapi.h:30
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_ENOEVST
Definition: fpapi.h:116
int _papi_hwi_add_event(EventSetInfo_t *ESI, int EventCode)
int EventSet

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_add_events ( int  EventSet,
int Events,
int  number 
)

add array of PAPI preset or native hardware events to an event set

Definition at line 5720 of file papi.c.

5721 {
5722  int i, retval;
5723 
5724  if ( ( Events == NULL ) || ( number <= 0 ) )
5726 
5727  for ( i = 0; i < number; i++ ) {
5728  retval = PAPI_add_event( EventSet, Events[i] );
5729  if ( retval != PAPI_OK ) {
5730  if ( i == 0 )
5731  papi_return( retval );
5732  else
5733  return ( i );
5734  }
5735  }
5736  return ( PAPI_OK );
5737 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1604
static int Events[NUM_EVENTS]
Definition: init_fini.c:8
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
int i
Definition: fileop.c:140
int EventSet
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_add_named_event ( int  EventSet,
char *  EventName 
)

add an event by name to a PAPI event set

Definition at line 1816 of file papi.c.

1817 {
1818  int ret, code;
1819 
1820  ret = PAPI_event_name_to_code( EventName, &code );
1821  if ( ret == PAPI_OK ) ret = PAPI_add_event( EventSet, code );
1822  papi_return( ret );
1823 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1604
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
long long ret
Definition: iozone.c:1346
int PAPI_event_name_to_code(char *in, int *out)
Definition: papi.c:1008
int EventSet

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_assign_eventset_component ( int  EventSet,
int  cidx 
)

assign a component index to an existing but empty eventset

Definition at line 1467 of file papi.c.

1468 {
1469  EventSetInfo_t *ESI;
1470  int retval;
1471 
1473  if ( ESI == NULL )
1475 
1476 /* validate cidx */
1477  retval = valid_component( cidx );
1478  if ( retval < 0 )
1479  papi_return( retval );
1480 
1481 /* cowardly refuse to reassign eventsets */
1482  if ( ESI->CmpIdx >= 0 )
1483  return PAPI_EINVAL;
1484 
1485  return ( _papi_hwi_assign_eventset( ESI, cidx ) );
1486 }
#define papi_return(a)
Definition: papi.c:47
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_ENOEVST
Definition: fpapi.h:116
static int cidx
Definition: event_info.c:40
int EventSet
int _papi_hwi_assign_eventset(EventSetInfo_t *ESI, int cidx)
ssize_t retval
Definition: libasync.c:338
inline_static int valid_component(int cidx)
Definition: papi.c:81

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_attach ( int  EventSet,
unsigned long  tid 
)

attach specified event set to a specific process or thread id

Definition at line 3110 of file papi.c.

3111 {
3112  APIDBG( "Entry: EventSet: %d\n", EventSet);
3113  return ( _papi_set_attach( PAPI_ATTACH, EventSet, tid ) );
3114 }
inline_static int _papi_set_attach(int option, int EventSet, unsigned long tid)
Definition: papi.c:3049
#define APIDBG(format, args...)
Definition: papi_debug.h:64
void *long long tid
Definition: iozone.c:18586
#define PAPI_ATTACH
Definition: fpapi.h:62
int EventSet

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_cleanup_eventset ( int  EventSet)

remove all PAPI events from an event set

Definition at line 2805 of file papi.c.

2806 {
2807  EventSetInfo_t *ESI;
2808  int i, cidx, total, retval;
2809 
2810  APIDBG("Attempting to cleanup Eventset %d\n",EventSet);
2811 
2812  /* Is the EventSet already in existence? */
2813 
2815  if ( ESI == NULL )
2817 
2818  /* if the eventset has no index and no events, return OK
2819  otherwise return NOCMP */
2820  cidx = valid_ESI_component( ESI );
2821  if ( cidx < 0 ) {
2822  if ( ESI->NumberOfEvents )
2823  papi_return( cidx );
2824  papi_return( PAPI_OK );
2825  }
2826 
2827  /* Of course, it must be stopped in order to modify it. */
2828 
2829  if ( ESI->state & PAPI_RUNNING )
2831 
2832  /* clear overflow flag and turn off hardware overflow handler */
2833  if ( ESI->state & PAPI_OVERFLOWING ) {
2834  total = ESI->overflow.event_counter;
2835  for ( i = 0; i < total; i++ ) {
2836  retval = PAPI_overflow( EventSet,
2837  ESI->overflow.EventCode[0], 0, 0, NULL );
2838  if ( retval != PAPI_OK )
2839  papi_return( retval );
2840  }
2841  }
2842 
2843  /* clear profile flag and turn off hardware profile handler */
2844  if ( ( ESI->state & PAPI_PROFILING ) &&
2845  _papi_hwd[cidx]->cmp_info.hardware_intr &&
2846  !( ESI->profile.flags & PAPI_PROFIL_FORCE_SW ) ) {
2847  total = ESI->profile.event_counter;
2848  for ( i = 0; i < total; i++ ) {
2849  retval =
2850  PAPI_sprofil( NULL, 0, EventSet, ESI->profile.EventCode[0], 0,
2852  if ( retval != PAPI_OK )
2853  papi_return( retval );
2854  }
2855  }
2856 
2857  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2858  retval = MPX_cleanup( &ESI->multiplex.mpx_evset );
2859  if ( retval != PAPI_OK )
2860  papi_return( retval );
2861  }
2862 
2863  retval = _papi_hwd[cidx]->cleanup_eventset( ESI->ctl_state );
2864  if ( retval != PAPI_OK )
2865  papi_return( retval );
2866 
2867  /* Now do the magic */
2869 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
int _papi_hwi_cleanup_eventset(EventSetInfo_t *ESI)
#define papi_return(a)
Definition: papi.c:47
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_EISRUN
Definition: fpapi.h:115
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_RUNNING
Definition: fpapi.h:30
int PAPI_overflow(int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler)
Definition: papi.c:4668
#define PAPI_PROFIL_POSIX
Definition: fpapi.h:75
int PAPI_sprofil(PAPI_sprofil_t *prof, int profcnt, int EventSet, int EventCode, int threshold, int flags)
Definition: papi.c:4923
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_OVERFLOWING
Definition: fpapi.h:33
#define PAPI_PROFILING
Definition: fpapi.h:34
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define PAPI_ENOEVST
Definition: fpapi.h:116
static int cidx
Definition: event_info.c:40
int MPX_cleanup(MPX_EventSet **mpx_events)
inline_static int valid_ESI_component(EventSetInfo_t *ESI)
Definition: papi.c:89
EventSetMultiplexInfo_t multiplex
int EventSet
static int total
Definition: rapl_overflow.c:5
#define PAPI_PROFIL_FORCE_SW
Definition: papi.h:401
struct papi_vectors * _papi_hwd[]
EventSetProfileInfo_t profile
hwd_control_state_t * ctl_state
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_create_eventset ( int EventSet)

create a new empty PAPI event set

Definition at line 1406 of file papi.c.

1407 {
1408  APIDBG("Entry: EventSet: %p\n", EventSet);
1409  ThreadInfo_t *master;
1410  int retval;
1411 
1412  if ( init_level == PAPI_NOT_INITED )
1414  retval = _papi_hwi_lookup_or_create_thread( &master, 0 );
1415  if ( retval )
1416  papi_return( retval );
1417 
1419 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOINIT
Definition: fpapi.h:121
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int EventSet
inline_static int _papi_hwi_lookup_or_create_thread(ThreadInfo_t **here, int tid)
Definition: threads.h:145
int init_level
Definition: papi_internal.c:54
ssize_t retval
Definition: libasync.c:338
#define PAPI_NOT_INITED
Definition: fpapi.h:17
int _papi_hwi_create_eventset(int *EventSet, ThreadInfo_t *handle)

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_destroy_eventset ( int EventSet)

deallocates memory associated with an empty PAPI event set

Definition at line 1944 of file papi.c.

1945 {
1946  EventSetInfo_t *ESI;
1947 
1948  APIDBG("Destroying Eventset %d\n",*EventSet);
1949 
1950  /* check for pre-existing ESI */
1951 
1952  if ( EventSet == NULL )
1954 
1956  if ( ESI == NULL )
1958 
1959  if ( !( ESI->state & PAPI_STOPPED ) )
1961 
1962  if ( ESI->NumberOfEvents )
1964 
1966  *EventSet = PAPI_NULL;
1967 
1968  return PAPI_OK;
1969 }
#define PAPI_NULL
Definition: fpapi.h:13
#define papi_return(a)
Definition: papi.c:47
#define PAPI_EISRUN
Definition: fpapi.h:115
int _papi_hwi_remove_EventSet(EventSetInfo_t *ESI)
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_STOPPED
Definition: fpapi.h:29
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_ENOEVST
Definition: fpapi.h:116
int EventSet

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_detach ( int  EventSet)

detach specified event set from a previously specified process or thread id

Definition at line 3167 of file papi.c.

3168 {
3169  return ( _papi_set_attach( PAPI_DETACH, EventSet, 0 ) );
3170 }
inline_static int _papi_set_attach(int option, int EventSet, unsigned long tid)
Definition: papi.c:3049
#define PAPI_DETACH
Definition: fpapi.h:66
int EventSet

Here is the call graph for this function:

Disables a component before init

Definition at line 6539 of file papi.c.

6540 {
6541 
6542  const PAPI_component_info_t *cinfo;
6543 
6544  /* Can only run before PAPI_library_init() is called */
6545  if (init_level != PAPI_NOT_INITED) {
6546  return PAPI_ENOINIT;
6547  }
6548 
6549  cinfo=PAPI_get_component_info(cidx);
6550  if (cinfo==NULL) return PAPI_ENOCMP;
6551 
6552  ((PAPI_component_info_t *)cinfo)->disabled=1;
6553  strcpy(((PAPI_component_info_t *)cinfo)->disabled_reason,
6554  "Disabled by PAPI_disable_component()");
6555 
6556  return PAPI_OK;
6557 
6558 }
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:805
#define PAPI_ENOINIT
Definition: fpapi.h:121
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_ENOCMP
Definition: fpapi.h:122
static int cidx
Definition: event_info.c:40
strcpy(filename, default_filename)
int init_level
Definition: papi_internal.c:54
#define PAPI_NOT_INITED
Definition: fpapi.h:17

Here is the call graph for this function:

Here is the caller graph for this function:

Disable, before library init, a component by name.

Definition at line 6589 of file papi.c.

6590 {
6591  int cidx;
6592 
6593  /* I can only be called before init time */
6594  if (init_level!=PAPI_NOT_INITED) {
6595  return PAPI_ENOINIT;
6596  }
6597 
6599  if (cidx>=0) {
6600  return PAPI_disable_component(cidx);
6601  }
6602 
6603  return PAPI_ENOCMP;
6604 }
#define PAPI_ENOINIT
Definition: fpapi.h:121
#define PAPI_ENOCMP
Definition: fpapi.h:122
int PAPI_disable_component(int cidx)
Definition: papi.c:6539
static int cidx
Definition: event_info.c:40
int PAPI_get_component_index(char *name)
Definition: papi.c:6483
char * name
Definition: iozone.c:23648
int init_level
Definition: papi_internal.c:54
#define PAPI_NOT_INITED
Definition: fpapi.h:17

Here is the call graph for this function:

int PAPI_enum_cmp_event ( int EventCode,
int  modifier,
int  cidx 
)

return the event code for the next available component event

Definition at line 1311 of file papi.c.

1312 {
1313  int i = *EventCode;
1314  int retval;
1315  int event_code;
1316 
1317  APIDBG( "Entry: EventCode: %#x, modifier: %d, cidx: %d\n", *EventCode, modifier, cidx);
1318  if ( _papi_hwi_invalid_cmp(cidx) || ( (IS_PRESET(i)) && cidx > 0 ) ) {
1319  return PAPI_ENOCMP;
1320  }
1321 
1322  if (_papi_hwd[cidx]->cmp_info.disabled) {
1323  return PAPI_ENOCMP;
1324  }
1325 
1326  if ( IS_PRESET(i) ) {
1327  if ( modifier == PAPI_ENUM_FIRST ) {
1328  *EventCode = ( int ) PAPI_PRESET_MASK;
1329  return PAPI_OK;
1330  }
1331  i &= PAPI_PRESET_AND_MASK;
1332  while ( ++i < PAPI_MAX_PRESET_EVENTS ) {
1333  if ( _papi_hwi_presets[i].symbol == NULL )
1334  return ( PAPI_ENOEVNT ); /* NULL pointer terminates list */
1335  if ( modifier & PAPI_PRESET_ENUM_AVAIL ) {
1336  if ( _papi_hwi_presets[i].count == 0 )
1337  continue;
1338  }
1339  *EventCode = ( int ) ( i | PAPI_PRESET_MASK );
1340  return PAPI_OK;
1341  }
1342  } else if ( IS_NATIVE(i) ) {
1343 
1344  /* Should we check against num native events here? */
1345  event_code=_papi_hwi_eventcode_to_native(*EventCode);
1346  retval = _papi_hwd[cidx]->ntv_enum_events((unsigned int *)&event_code, modifier );
1347 
1348  if (retval!=PAPI_OK) {
1349  SUBDBG("VMW: retval=%d\n",retval);
1350  return PAPI_EINVAL;
1351  }
1352 
1353  /* re-apply Component ID to the returned Event */
1354  *EventCode = _papi_hwi_native_to_eventcode(cidx,event_code);
1355 
1356  return retval;
1357  }
1358 
1360 }
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define PAPI_ENOCMP
Definition: fpapi.h:122
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define IS_NATIVE(EventCode)
Definition: papi.h:226
static int cidx
Definition: event_info.c:40
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _papi_hwi_native_to_eventcode(int cidx, int event_code)
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
int
Definition: iozone.c:18528
#define PAPI_PRESET_AND_MASK
struct papi_vectors * _papi_hwd[]
int _papi_hwi_invalid_cmp(int cidx)
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_enum_event ( int EventCode,
int  modifier 
)

return the event code for the next available preset or natvie event

Definition at line 1148 of file papi.c.

1149 {
1150  int i = *EventCode;
1151  int retval;
1152  int cidx;
1153  int event_code;
1154 
1155  APIDBG( "Entry: EventCode: %#x, modifier: %d\n", *EventCode, modifier);
1156  cidx = _papi_hwi_component_index( *EventCode );
1157  if (cidx < 0) return PAPI_ENOCMP;
1158 
1159  /* Do we handle presets in componets other than CPU? */
1160  /* if (( IS_PRESET(i) ) && cidx > 0 )) return PAPI_ENOCMP; */
1161 
1162  if ( IS_PRESET(i) ) {
1163  if ( modifier == PAPI_ENUM_FIRST ) {
1164  *EventCode = ( int ) PAPI_PRESET_MASK;
1165  return ( PAPI_OK );
1166  }
1167  i &= PAPI_PRESET_AND_MASK;
1168  while ( ++i < PAPI_MAX_PRESET_EVENTS ) {
1169  if ( _papi_hwi_presets[i].symbol == NULL )
1170  return ( PAPI_ENOEVNT ); /* NULL pointer terminates list */
1171  if ( modifier & PAPI_PRESET_ENUM_AVAIL ) {
1172  if ( _papi_hwi_presets[i].count == 0 )
1173  continue;
1174  }
1175  *EventCode = ( int ) ( i | PAPI_PRESET_MASK );
1176  return ( PAPI_OK );
1177  }
1178  } else if ( IS_NATIVE(i) ) {
1179  /* Should check against num native events here */
1180 
1181  event_code=_papi_hwi_eventcode_to_native((int)*EventCode);
1182  retval = _papi_hwd[cidx]->ntv_enum_events((unsigned int *)&event_code, modifier );
1183 
1184  /* re-apply Component ID to the returned Event */
1185  *EventCode = _papi_hwi_native_to_eventcode(cidx,event_code);
1186 
1187  return retval;
1188  } else if ( IS_USER_DEFINED(i) ) {
1189  if ( modifier == PAPI_ENUM_FIRST ) {
1190  *EventCode = (int) 0x0;
1191  return ( PAPI_OK );
1192  }
1193 
1194  i &= PAPI_UE_AND_MASK;
1195  ++i;
1196 
1197  if ( (int)_papi_user_events_count <= i )
1198  *EventCode = i;
1199  return ( PAPI_OK );
1200  }
1201 
1203 }
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define PAPI_ENOCMP
Definition: fpapi.h:122
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define IS_NATIVE(EventCode)
Definition: papi.h:226
static int cidx
Definition: event_info.c:40
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
int _papi_hwi_native_to_eventcode(int cidx, int event_code)
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
int
Definition: iozone.c:18528
int _papi_hwi_component_index(int event_code)
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
struct papi_vectors * _papi_hwd[]
int _papi_hwi_eventcode_to_native(int event_code)
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_event_code_to_name ( int  EventCode,
char *  out 
)

translate an integer PAPI event code into an ASCII PAPI preset or native name

Definition at line 924 of file papi.c.

925 {
926  APIDBG( "Entry: EventCode: %#x\n", EventCode);
927  if ( out == NULL )
929 
930  if ( IS_PRESET(EventCode) ) {
931  EventCode &= PAPI_PRESET_AND_MASK;
932  if ( ( EventCode >= PAPI_MAX_PRESET_EVENTS )
933  || ( _papi_hwi_presets[EventCode].symbol == NULL ) )
935 
936  strncpy( out, _papi_hwi_presets[EventCode].symbol,
938  papi_return( PAPI_OK );
939  }
940 
941  if ( IS_NATIVE(EventCode) ) {
943  ( ( unsigned int ) EventCode, out, PAPI_MAX_STR_LEN ) );
944  }
945 
946  if ( IS_USER_DEFINED(EventCode) ) {
947  EventCode &= PAPI_UE_AND_MASK;
948 
949  if ( EventCode < 0 || EventCode > (int)_papi_user_events_count )
951 
952  strncpy( out, _papi_user_events[EventCode].symbol,
954  papi_return( PAPI_OK );
955  }
956 
958 }
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
#define papi_return(a)
Definition: papi.c:47
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
#define PAPI_ENOEVNT
Definition: fpapi.h:112
int _papi_hwi_native_code_to_name(unsigned int EventCode, char *hwi_name, int len)
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define IS_NATIVE(EventCode)
Definition: papi.h:226
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
user_defined_event_t * _papi_user_events
#define PAPI_ENOTPRESET
Definition: fpapi.h:117
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_event_name_to_code ( char *  in,
int out 
)

translate an ASCII PAPI preset or native name into an integer PAPI event code

Definition at line 1008 of file papi.c.

1009 {
1010  APIDBG("Entry: in: %p, name: %s, out: %p\n", in, in, out);
1011  int i;
1012 
1013  if ( ( in == NULL ) || ( out == NULL ) )
1015 
1016  if ( init_level == PAPI_NOT_INITED )
1018 
1019  /* All presets start with "PAPI_" so no need to */
1020  /* do an exhaustive search if that's not there */
1021  if (strncmp(in, "PAPI_", 5) == 0) {
1022  for(i = 0; i < PAPI_MAX_PRESET_EVENTS; i++ ) {
1023  if ( ( _papi_hwi_presets[i].symbol )
1024  && ( strcasecmp( _papi_hwi_presets[i].symbol, in ) == 0) ) {
1025  *out = ( int ) ( i | PAPI_PRESET_MASK );
1026  papi_return( PAPI_OK );
1027  }
1028  }
1029  }
1030 
1031  for ( i=0; i < (int)_papi_user_events_count; i++ ) {
1032  if ( strcasecmp( _papi_user_events[i].symbol, in ) == 0 ) {
1033  *out = (int) ( i | PAPI_UE_MASK );
1034  papi_return( PAPI_OK );
1035  }
1036  }
1037 
1039 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOINIT
Definition: fpapi.h:121
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
int _papi_hwi_native_name_to_code(char *in, int *out)
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
int
Definition: iozone.c:18528
user_defined_event_t * _papi_user_events
int init_level
Definition: papi_internal.c:54
#define PAPI_UE_MASK
unsigned int _papi_user_events_count
#define PAPI_NOT_INITED
Definition: fpapi.h:17

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_cmp_opt ( int  option,
PAPI_option_t ptr,
int  cidx 
)

query the component specific option settings of a specific event set

Definition at line 4233 of file papi.c.

4234 {
4235 
4236  APIDBG( "Entry: option: %d, cidx: %d\n", option, cidx);
4237  if (_papi_hwi_invalid_cmp(cidx)) {
4238  return PAPI_ECMP;
4239  }
4240 
4241  switch ( option ) {
4242  /* For now, MAX_HWCTRS and MAX CTRS are identical.
4243  At some future point, they may map onto different values.
4244  */
4245  case PAPI_MAX_HWCTRS:
4246  return ( _papi_hwd[cidx]->cmp_info.num_cntrs );
4247  case PAPI_MAX_MPX_CTRS:
4248  return ( _papi_hwd[cidx]->cmp_info.num_mpx_cntrs );
4249  case PAPI_DEFDOM:
4250  return ( _papi_hwd[cidx]->cmp_info.default_domain );
4251  case PAPI_DEFGRN:
4252  return ( _papi_hwd[cidx]->cmp_info.default_granularity );
4253  case PAPI_SHLIBINFO:
4254  {
4255  int retval;
4256  if ( ptr == NULL )
4260  papi_return( retval );
4261  }
4262  case PAPI_COMPONENTINFO:
4263  if ( ptr == NULL )
4265  ptr->cmp_info = &( _papi_hwd[cidx]->cmp_info );
4266  return PAPI_OK;
4267  default:
4269  }
4270  return PAPI_OK;
4271 }
#define papi_return(a)
Definition: papi.c:47
int(* update_shlib_info)(papi_mdi_t *mdi)
Definition: papi_vector.h:67
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_shlib_info_t shlib_info
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_COMPONENTINFO
Definition: fpapi.h:65
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
#define PAPI_MAX_HWCTRS
Definition: fpapi.h:58
#define PAPI_SHLIBINFO
Definition: fpapi.h:63
#define PAPI_MAX_MPX_CTRS
Definition: fpapi.h:54
static int cidx
Definition: event_info.c:40
#define PAPI_ECMP
Definition: fpapi.h:109
#define PAPI_DEFDOM
Definition: fpapi.h:49
#define PAPI_DEFGRN
Definition: fpapi.h:51
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
struct papi_vectors * _papi_hwd[]
int _papi_hwi_invalid_cmp(int cidx)
PAPI_shlib_info_t * shlib_info
Definition: papi.h:857
ssize_t retval
Definition: libasync.c:338
PAPI_component_info_t * cmp_info
Definition: papi.h:859

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_component_index ( char *  name)

Return component index for component with matching name

Definition at line 6483 of file papi.c.

6484 {
6485  int cidx;
6486 
6487  const PAPI_component_info_t *cinfo;
6488 
6489  APIDBG( "Entry:\n" );
6490  for(cidx=0;cidx<papi_num_components;cidx++) {
6491 
6492  cinfo=PAPI_get_component_info(cidx);
6493  if (cinfo==NULL) return PAPI_ENOCMP;
6494 
6495  if (!strcmp(name,cinfo->name)) {
6496  return cidx;
6497  }
6498  }
6499 
6500  return PAPI_ENOCMP;
6501 }
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:805
#define PAPI_ENOCMP
Definition: fpapi.h:122
#define APIDBG(format, args...)
Definition: papi_debug.h:64
static int cidx
Definition: event_info.c:40
int papi_num_components
char * name
Definition: iozone.c:23648

Here is the call graph for this function:

Here is the caller graph for this function:

get information about the component features

Definition at line 805 of file papi.c.

806 {
807  APIDBG( "Entry: Component Index %d\n", cidx);
808  if ( _papi_hwi_invalid_cmp( cidx ) )
809  return ( NULL );
810  else
811  return ( &( _papi_hwd[cidx]->cmp_info ) );
812 }
#define APIDBG(format, args...)
Definition: papi_debug.h:64
static int cidx
Definition: event_info.c:40
struct papi_vectors * _papi_hwd[]
int _papi_hwi_invalid_cmp(int cidx)

Here is the call graph for this function:

Here is the caller graph for this function:

get dynamic memory usage information

Definition at line 5937 of file papi.c.

5938 {
5939  if ( dest == NULL )
5940  return PAPI_EINVAL;
5941 
5942  memset( ( void * ) dest, 0x0, sizeof ( PAPI_dmem_info_t ) );
5943  return ( _papi_os_vector.get_dmem_info( dest ) );
5944 }
memset(eventId, 0, size)
return PAPI_EINVAL
Definition: linux-nvml.c:408
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
A pointer to the following is passed to PAPI_get_dmem_info()
Definition: papi.h:866
int(* get_dmem_info)(PAPI_dmem_info_t *)
Definition: papi_vector.h:70

Here is the call graph for this function:

Here is the caller graph for this function:

return which component an EventCode belongs to

Definition at line 6456 of file papi.c.

6457 {
6458  APIDBG( "Entry: EventCode: %#x\n", EventCode);
6459  return _papi_hwi_component_index( EventCode);
6460 }
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int _papi_hwi_component_index(int event_code)

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_event_info ( int  EventCode,
PAPI_event_info_t info 
)

get the name and descriptions for a given preset or native event code

Definition at line 844 of file papi.c.

845 {
846  int i;
847  APIDBG( "Entry: EventCode: %#x\n", EventCode);
848 
849  if ( info == NULL )
851 
852  if ( IS_PRESET(EventCode) ) {
853  i = EventCode & PAPI_PRESET_AND_MASK;
854  if ( i >= PAPI_MAX_PRESET_EVENTS )
856  papi_return( _papi_hwi_get_preset_event_info( EventCode, info ) );
857  }
858 
859  if ( IS_NATIVE(EventCode) ) {
861  ( ( unsigned int ) EventCode, info ) );
862  }
863 
864  if ( IS_USER_DEFINED(EventCode) ) {
865  papi_return( PAPI_OK );
866  }
868 }
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define IS_NATIVE(EventCode)
Definition: papi.h:226
int _papi_hwi_get_native_event_info(unsigned int EventCode, PAPI_event_info_t *info)
int _papi_hwi_get_preset_event_info(int EventCode, PAPI_event_info_t *info)
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
#define PAPI_PRESET_AND_MASK
#define PAPI_ENOTPRESET
Definition: fpapi.h:117

Here is the call graph for this function:

Here is the caller graph for this function:

return which component an EventSet is assigned to

Definition at line 1510 of file papi.c.

1511 {
1512  EventSetInfo_t *ESI;
1513  int retval;
1514 
1515 /* validate eventset */
1517  if ( ESI == NULL )
1519 
1520 /* check if a component has been assigned */
1521  if ( ESI->CmpIdx < 0 )
1523 
1524 /* validate CmpIdx */
1525  retval = valid_component( ESI->CmpIdx );
1526  if ( retval < 0 )
1527  papi_return( retval );
1528 
1529 /* return the index */
1530  return ( ESI->CmpIdx );
1531 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOCMP
Definition: fpapi.h:122
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_ENOEVST
Definition: fpapi.h:116
int EventSet
ssize_t retval
Definition: libasync.c:338
inline_static int valid_component(int cidx)
Definition: papi.c:81

Here is the call graph for this function:

get the executable's address space information

Definition at line 5988 of file papi.c.

5989 {
5991  int retval;
5992 
5993  memset( &ptr, 0, sizeof ( ptr ) );
5994  retval = PAPI_get_opt( PAPI_EXEINFO, &ptr );
5995  if ( retval == PAPI_OK )
5996  return ( ptr.exe_info );
5997  else
5998  return ( NULL );
5999 }
memset(eventId, 0, size)
return PAPI_OK
Definition: linux-nvml.c:458
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:843
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4041
#define PAPI_EXEINFO
Definition: fpapi.h:60
PAPI_exe_info_t * exe_info
Definition: papi.h:858
ssize_t retval
Definition: libasync.c:338
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

get information about the system hardware

Definition at line 6059 of file papi.c.

6060 {
6062  int retval;
6063 
6064  memset( &ptr, 0, sizeof ( ptr ) );
6065  retval = PAPI_get_opt( PAPI_HWINFO, &ptr );
6066  if ( retval == PAPI_OK )
6067  return ( ptr.hw_info );
6068  else
6069  return ( NULL );
6070 }
memset(eventId, 0, size)
return PAPI_OK
Definition: linux-nvml.c:458
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:843
PAPI_hw_info_t * hw_info
Definition: papi.h:856
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4041
#define PAPI_HWINFO
Definition: fpapi.h:59
ssize_t retval
Definition: libasync.c:338
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_multiplex ( int  EventSet)

get the multiplexing status of specified event set

Definition at line 3927 of file papi.c.

3928 {
3929  PAPI_option_t popt;
3930  int retval;
3931 
3932  popt.multiplex.eventset = EventSet;
3933  retval = PAPI_get_opt( PAPI_MULTIPLEX, &popt );
3934  if ( retval < 0 )
3935  retval = 0;
3936  return retval;
3937 }
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:843
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4041
PAPI_multiplex_option_t multiplex
Definition: papi.h:854
int EventSet
ssize_t retval
Definition: libasync.c:338
#define PAPI_MULTIPLEX
Definition: fpapi.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_opt ( int  option,
PAPI_option_t ptr 
)

query the option settings of the PAPI library or a specific event set

Definition at line 4041 of file papi.c.

4042 {
4043  EventSetInfo_t *ESI;
4044 
4045  APIDBG( "Entry: option: %d\n", option);
4046  if ( ( option != PAPI_DEBUG ) && ( init_level == PAPI_NOT_INITED ) )
4048 
4049  switch ( option ) {
4050  case PAPI_DETACH:
4051  {
4052  if ( ptr == NULL )
4055  if ( ESI == NULL )
4057  ptr->attach.tid = ESI->attach.tid;
4058  return ( ( ESI->state & PAPI_ATTACHED ) == 0 );
4059  }
4060  case PAPI_ATTACH:
4061  {
4062  if ( ptr == NULL )
4065  if ( ESI == NULL )
4067  ptr->attach.tid = ESI->attach.tid;
4068  return ( ( ESI->state & PAPI_ATTACHED ) != 0 );
4069  }
4070  case PAPI_CPU_ATTACH:
4071  {
4072  if ( ptr == NULL )
4075  if ( ESI == NULL )
4077  ptr->cpu.cpu_num = ESI->CpuInfo->cpu_num;
4078  return ( ( ESI->state & PAPI_CPU_ATTACHED ) != 0 );
4079  }
4080  case PAPI_DEF_MPX_NS:
4081  {
4082  /* xxxx for now, assume we only check against cpu component */
4083  if ( ptr == NULL )
4086  return ( PAPI_OK );
4087  }
4088  case PAPI_DEF_ITIMER_NS:
4089  {
4090  /* xxxx for now, assume we only check against cpu component */
4091  if ( ptr == NULL )
4094  return ( PAPI_OK );
4095  }
4096  case PAPI_DEF_ITIMER:
4097  {
4098  /* xxxx for now, assume we only check against cpu component */
4099  if ( ptr == NULL )
4104  ptr->itimer.flags = 0;
4105  return ( PAPI_OK );
4106  }
4107  case PAPI_MULTIPLEX:
4108  {
4109  if ( ptr == NULL )
4112  if ( ESI == NULL )
4114  ptr->multiplex.ns = ESI->multiplex.ns;
4115  ptr->multiplex.flags = ESI->multiplex.flags;
4116  return ( ESI->state & PAPI_MULTIPLEXING ) != 0;
4117  }
4118  case PAPI_PRELOAD:
4119  if ( ptr == NULL )
4121  memcpy( &ptr->preload, &_papi_hwi_system_info.preload_info,
4123  break;
4124  case PAPI_DEBUG:
4125  if ( ptr == NULL )
4129  break;
4130  case PAPI_CLOCKRATE:
4131  return ( ( int ) _papi_hwi_system_info.hw_info.cpu_max_mhz );
4132  case PAPI_MAX_CPUS:
4133  return ( _papi_hwi_system_info.hw_info.ncpu );
4134  /* For now, MAX_HWCTRS and MAX CTRS are identical.
4135  At some future point, they may map onto different values.
4136  */
4137  case PAPI_INHERIT:
4138  {
4139  if ( ptr == NULL )
4142  if ( ESI == NULL )
4144  ptr->inherit.inherit = ESI->inherit.inherit;
4145  return ( PAPI_OK );
4146  }
4147  case PAPI_GRANUL:
4148  if ( ptr == NULL )
4151  if ( ESI == NULL )
4154  break;
4155  case PAPI_EXEINFO:
4156  if ( ptr == NULL )
4159  break;
4160  case PAPI_HWINFO:
4161  if ( ptr == NULL )
4164  break;
4165 
4166  case PAPI_DOMAIN:
4167  if ( ptr == NULL )
4170  if ( ESI == NULL )
4172  ptr->domain.domain = ESI->domain.domain;
4173  return ( PAPI_OK );
4174  case PAPI_LIB_VERSION:
4175  return ( PAPI_VERSION );
4176 /* The following cases all require a component index
4177  and are handled by PAPI_get_cmp_opt() with cidx == 0*/
4178  case PAPI_MAX_HWCTRS:
4179  case PAPI_MAX_MPX_CTRS:
4180  case PAPI_DEFDOM:
4181  case PAPI_DEFGRN:
4182  case PAPI_SHLIBINFO:
4183  case PAPI_COMPONENTINFO:
4184  return ( PAPI_get_cmp_opt( option, ptr, 0 ) );
4185  default:
4187  }
4188  return ( PAPI_OK );
4189 }
#define PAPI_CPU_ATTACH
Definition: papi.h:455
#define PAPI_PRELOAD
Definition: fpapi.h:56
#define PAPI_DEF_ITIMER_NS
Definition: papi.h:453
#define papi_return(a)
Definition: papi.c:47
PAPI_debug_handler_t _papi_hwi_debug_handler
Definition: papi_internal.c:56
#define PAPI_ENOINIT
Definition: fpapi.h:121
EventSetAttachInfo_t attach
PAPI_granularity_option_t granularity
Definition: papi.h:848
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_inherit_option_t inherit
Definition: papi.h:847
#define PAPI_VERSION
Definition: fpapi.h:15
PAPI_preload_info_t preload_info
PAPI_exe_info_t exe_info
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
PAPI_hw_info_t * hw_info
Definition: papi.h:856
unsigned int cpu_num
Definition: papi.h:819
#define PAPI_INHERIT
Definition: papi.h:456
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_MULTIPLEXING
Definition: fpapi.h:35
#define PAPI_COMPONENTINFO
Definition: fpapi.h:65
EventSetInheritInfo_t inherit
#define PAPI_ENOEVST
Definition: fpapi.h:116
#define PAPI_MAX_HWCTRS
Definition: fpapi.h:58
struct _CpuInfo * CpuInfo
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
int PAPI_get_cmp_opt(int option, PAPI_option_t *ptr, int cidx)
Definition: papi.c:4233
#define PAPI_SHLIBINFO
Definition: fpapi.h:63
#define PAPI_HWINFO
Definition: fpapi.h:59
#define PAPI_MAX_MPX_CTRS
Definition: fpapi.h:54
#define PAPI_CPU_ATTACHED
Definition: fpapi.h:37
#define PAPI_DEFDOM
Definition: fpapi.h:49
PAPI_cpu_option_t cpu
Definition: papi.h:853
#define PAPI_DOMAIN
Definition: fpapi.h:50
#define PAPI_ATTACH
Definition: fpapi.h:62
int _papi_hwi_error_level
Definition: papi_internal.c:55
#define PAPI_DEFGRN
Definition: fpapi.h:51
PAPI_multiplex_option_t multiplex
Definition: papi.h:854
#define PAPI_GRANUL
Definition: fpapi.h:52
#define PAPI_DEF_MPX_NS
Definition: fpapi.h:53
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
PAPI_hw_info_t hw_info
again struct sockaddr sizeof(struct sockaddr_in))
#define PAPI_DETACH
Definition: fpapi.h:66
#define PAPI_EXEINFO
Definition: fpapi.h:60
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
PAPI_debug_handler_t handler
Definition: papi.h:685
unsigned long tid
Definition: papi.h:813
PAPI_attach_option_t attach
Definition: papi.h:852
PAPI_exe_info_t * exe_info
Definition: papi.h:858
#define PAPI_DEF_ITIMER
Definition: papi.h:452
PAPI_debug_option_t debug
Definition: papi.h:846
int cpu_max_mhz
Definition: papi.h:791
#define PAPI_ATTACHED
Definition: fpapi.h:36
PAPI_domain_option_t domain
Definition: papi.h:850
#define PAPI_DEBUG
Definition: fpapi.h:47
PAPI_preload_info_t preload
Definition: papi.h:845
int init_level
Definition: papi_internal.c:54
#define PAPI_CLOCKRATE
Definition: fpapi.h:57
PAPI_itimer_option_t itimer
Definition: papi.h:855
#define PAPI_MAX_CPUS
Definition: fpapi.h:61
#define PAPI_NOT_INITED
Definition: fpapi.h:17
#define PAPI_MULTIPLEX
Definition: fpapi.h:48
int ncpu
Definition: papi.h:776
#define PAPI_LIB_VERSION
Definition: fpapi.h:64

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_overflow_event_index ( int  Eventset,
long long  overflow_vector,
int array,
int number 
)

decomposes an overflow_vector into an event index array

Definition at line 6391 of file papi.c.

6393 {
6394  EventSetInfo_t *ESI;
6395  int set_bit, j, pos;
6396  int count = 0, k;
6397 
6398  if ( overflow_vector == ( long long ) 0 )
6400 
6401  if ( ( array == NULL ) || ( number == NULL ) )
6403 
6404  if ( *number < 1 )
6406 
6408  if ( ESI == NULL )
6410 
6411  /* in case the eventset is empty */
6412  if ( ESI->NumberOfEvents == 0 )
6414 
6415  while ( ( set_bit = ffsll( overflow_vector ) ) ) {
6416  set_bit -= 1;
6417  overflow_vector ^= ( long long ) 1 << set_bit;
6418  for ( j = 0; j < ESI->NumberOfEvents; j++ ) {
6419  for ( k = 0, pos = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT && pos >= 0; k++ ) {
6420  pos = ESI->EventInfoArray[j].pos[k];
6421  if ( ( set_bit == pos ) &&
6422  ( ( ESI->EventInfoArray[j].derived == NOT_DERIVED ) ||
6423  ( ESI->EventInfoArray[j].derived == DERIVED_CMPD ) ) ) {
6424  array[count++] = j;
6425  if ( count == *number )
6426  return PAPI_OK;
6427 
6428  break;
6429  }
6430  }
6431  }
6432  }
6433  *number = count;
6434  return PAPI_OK;
6435 }
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define DERIVED_CMPD
Definition: papi_internal.h:73
#define PAPI_ENOEVST
Definition: fpapi.h:116
#define NOT_DERIVED
Definition: papi_internal.h:69
int ffsll(long long lli)
Definition: extras.c:497
int k
Definition: iozone.c:19136
long long
Definition: iozone.c:19827
EventInfo_t * EventInfoArray
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
int EventSet
long j
Definition: iozone.c:19135

Here is the call graph for this function:

Here is the caller graph for this function:

return the total number of cycles since some arbitrary starting point

Definition at line 6091 of file papi.c.

6092 {
6093  return ( _papi_os_vector.get_real_cycles( ) );
6094 }
long long(* get_real_cycles)(void)
Definition: papi_vector.h:61
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288

Here is the caller graph for this function:

return the total number of nanoseconds since some arbitrary starting point

Definition at line 6111 of file papi.c.

6112 {
6113  return ( ( _papi_os_vector.get_real_nsec( )));
6114 
6115 }
long long(* get_real_nsec)(void)
Definition: papi_vector.h:65
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288

Here is the caller graph for this function:

return the total number of microseconds since some arbitrary starting point

Definition at line 6138 of file papi.c.

6139 {
6140  return ( _papi_os_vector.get_real_usec( ) );
6141 }
long long(* get_real_usec)(void)
Definition: papi_vector.h:63
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288

Here is the caller graph for this function:

get information about the shared libraries used by the process

Definition at line 6018 of file papi.c.

6019 {
6021  int retval;
6022 
6023  memset( &ptr, 0, sizeof ( ptr ) );
6024  retval = PAPI_get_opt( PAPI_SHLIBINFO, &ptr );
6025  if ( retval == PAPI_OK )
6026  return ( ptr.shlib_info );
6027  else
6028  return ( NULL );
6029 }
memset(eventId, 0, size)
return PAPI_OK
Definition: linux-nvml.c:458
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:843
#define PAPI_SHLIBINFO
Definition: fpapi.h:63
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4041
PAPI_shlib_info_t * shlib_info
Definition: papi.h:857
ssize_t retval
Definition: libasync.c:338
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_get_thr_specific ( int  tag,
void **  ptr 
)

return a pointer to a thread specific stored data structure

Definition at line 357 of file papi.c.

358 {
360  int doall = 0, retval = PAPI_OK;
361 
362  if ( init_level == PAPI_NOT_INITED )
364  if ( tag & PAPI_TLS_ALL_THREADS ) {
365  tag = tag ^ PAPI_TLS_ALL_THREADS;
366  doall = 1;
367  }
368  if ( ( tag < 0 ) || ( tag > PAPI_TLS_NUM ) )
370 
371  if ( doall )
373  ( tag, ( PAPI_all_thr_spec_t * ) ptr ) );
374 
376  if ( retval == PAPI_OK )
377  *ptr = thread->thread_storage[tag];
378  else
379  papi_return( retval );
380 
381  return ( PAPI_OK );
382 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOINIT
Definition: fpapi.h:121
#define PAPI_TLS_NUM
Definition: fpapi.h:93
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
void * thread_storage[PAPI_MAX_TLS]
Definition: threads.h:29
#define PAPI_TLS_ALL_THREADS
Definition: papi.h:325
void * thread(void *arg)
Definition: kufrin.c:31
inline_static int _papi_hwi_lookup_or_create_thread(ThreadInfo_t **here, int tid)
Definition: threads.h:145
int _papi_hwi_gather_all_thrspec_data(int tag, PAPI_all_thr_spec_t *where)
Definition: threads.c:554
int init_level
Definition: papi_internal.c:54
ssize_t retval
Definition: libasync.c:338
#define PAPI_NOT_INITED
Definition: fpapi.h:17
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

return the process cycles since some arbitrary starting point

Definition at line 6174 of file papi.c.

6175 {
6176 
6177  return ( ( long long ) _papi_os_vector.get_virt_cycles( ) );
6178 }
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
long long(* get_virt_cycles)(void)
Definition: papi_vector.h:62

Here is the caller graph for this function:

return the process nanoseconds since some arbitrary starting point

Definition at line 6204 of file papi.c.

6205 {
6206 
6207  return ( ( _papi_os_vector.get_virt_nsec()));
6208 
6209 }
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
long long(* get_virt_nsec)(void)
Definition: papi_vector.h:66

return the process microseconds since some arbitrary starting point

Definition at line 6246 of file papi.c.

6247 {
6248 
6249  return ( ( long long ) _papi_os_vector.get_virt_usec() );
6250 }
long long(* get_virt_usec)(void)
Definition: papi_vector.h:64
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288

Here is the caller graph for this function:

return the initialized state of the PAPI library

Definition at line 6337 of file papi.c.

6338 {
6339  return ( init_level );
6340 }
int init_level
Definition: papi_internal.c:54

Here is the caller graph for this function:

int PAPI_library_init ( int  version)

initialize the PAPI library

Definition at line 495 of file papi.c.

496 {
497  APIDBG( "Entry: version: %#x\n", version);
498  char *filename;
499  int tmp = 0, tmpel;
500 
501  /* This is a poor attempt at a lock.
502  For 3.1 this should be replaced with a
503  true UNIX semaphore. We cannot use PAPI
504  locks here because they are not initialized yet */
505  static int _in_papi_library_init_cnt = 0;
506 #ifdef DEBUG
507  char *var;
508 #endif
510 
511  if ( version != PAPI_VER_CURRENT )
513 
514  ++_in_papi_library_init_cnt;
515  while ( _in_papi_library_init_cnt > 1 ) {
516  PAPIERROR( "Multiple callers of PAPI_library_init" );
517  sleep( 1 );
518  }
519 
520  /* This checks to see if we have forked or called init more than once.
521  If we have forked, then we continue to init. If we have not forked,
522  we check to see the status of initialization. */
523 
524  APIDBG( "Initializing library: current PID %d, old PID %d\n",
525  getpid( ), _papi_hwi_system_info.pid );
526 
527  if ( _papi_hwi_system_info.pid == getpid( ) ) {
528  /* If the magic environment variable PAPI_ALLOW_STOLEN is set,
529  we call shutdown if PAPI has been initialized. This allows
530  tools that use LD_PRELOAD to run on applications that use PAPI.
531  In this circumstance, PAPI_ALLOW_STOLEN will be set to 'stolen'
532  so the tool can check for this case. */
533 
534  if ( getenv( "PAPI_ALLOW_STOLEN" ) ) {
535  char buf[PAPI_HUGE_STR_LEN];
536  if ( init_level != PAPI_NOT_INITED )
537  PAPI_shutdown( );
538  sprintf( buf, "%s=%s", "PAPI_ALLOW_STOLEN", "stolen" );
539  putenv( buf );
540  }
541 
542  /* If the library has been successfully initialized *OR*
543  the library attempted initialization but failed. */
544 
545  else if ( ( init_level != PAPI_NOT_INITED ) ||
546  ( init_retval != DEADBEEF ) ) {
547  _in_papi_library_init_cnt--;
548  if ( init_retval < PAPI_OK )
550  else
551  return ( init_retval );
552  }
553 
554  APIDBG( "system_info was initialized, but init did not succeed\n" );
555  }
556 #ifdef DEBUG
557  var = ( char * ) getenv( "PAPI_DEBUG" );
558  _papi_hwi_debug = 0;
559 
560  if ( var != NULL ) {
561  if ( strlen( var ) != 0 ) {
562  if ( strstr( var, "SUBSTRATE" ) )
564  if ( strstr( var, "API" ) )
566  if ( strstr( var, "INTERNAL" ) )
568  if ( strstr( var, "THREADS" ) )
570  if ( strstr( var, "MULTIPLEX" ) )
572  if ( strstr( var, "OVERFLOW" ) )
574  if ( strstr( var, "PROFILE" ) )
576  if ( strstr( var, "MEMORY" ) )
578  if ( strstr( var, "LEAK" ) )
580  if ( strstr( var, "ALL" ) )
582  }
583 
584  if ( _papi_hwi_debug == 0 )
586  }
587 #endif
588 
589  /* Be verbose for now */
590 
591  tmpel = _papi_hwi_error_level;
593 
594  /* Initialize internal globals */
596  _in_papi_library_init_cnt--;
597  _papi_hwi_error_level = tmpel;
599  }
600 
601  /* Initialize OS */
602  tmp = _papi_hwi_init_os();
603  if ( tmp ) {
604  init_retval = tmp;
606  _in_papi_library_init_cnt--;
607  _papi_hwi_error_level = tmpel;
609  }
610 
611  /* Initialize component globals */
612 
613  tmp = _papi_hwi_init_global( );
614  if ( tmp ) {
615  init_retval = tmp;
617  _in_papi_library_init_cnt--;
618  _papi_hwi_error_level = tmpel;
620  }
621 
622  /* Initialize thread globals, including the main threads */
623 
625  if ( tmp ) {
626  int i;
627  init_retval = tmp;
629  for ( i = 0; i < papi_num_components; i++ ) {
630  if (!_papi_hwd[i]->cmp_info.disabled) {
631  _papi_hwd[i]->shutdown_component( );
632  }
633  }
634  _in_papi_library_init_cnt--;
635  _papi_hwi_error_level = tmpel;
637  }
638 
640  _in_papi_library_init_cnt--;
641  _papi_hwi_error_level = tmpel;
642 
643 #ifdef STATIC_USER_EVENTS
645 #endif
646 
647  if ( (filename = getenv( "PAPI_USER_EVENTS_FILE" )) != NULL ) {
649  }
650 
651  return ( init_retval = PAPI_VER_CURRENT );
652 }
#define PAPI_HUGE_STR_LEN
Definition: fpapi.h:42
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
#define DEBUG_MULTIPLEX
Definition: papi_debug.h:31
int _papi_hwi_init_global_internal(void)
#define DEBUG_PROFILE
Definition: papi_debug.h:33
char * getenv()
sleep(1)
int _papi_hwi_debug
Definition: papi.c:74
#define papi_return(a)
Definition: papi.c:47
#define PAPI_VERB_ECONT
Definition: fpapi.h:39
int _papi_user_defined_events_setup(char *name)
return PAPI_OK
Definition: linux-nvml.c:458
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
return PAPI_EINVAL
Definition: linux-nvml.c:408
void _papi_hwi_init_errors(void)
#define DEBUG_MEMORY
Definition: papi_debug.h:34
#define DEBUG_API
Definition: papi_debug.h:28
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define DEADBEEF
Definition: papi_internal.h:26
#define DEBUG_ALL
Definition: papi_debug.h:36
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
void PAPI_shutdown(void)
Definition: papi.c:4357
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
#define DEBUG_LEAK
Definition: papi_debug.h:35
void PAPIERROR(char *format,...)
void _papi_hwi_shutdown_global_internal(void)
#define DEBUG_INTERNAL
Definition: papi_debug.h:29
int _papi_hwi_error_level
Definition: papi_internal.c:55
char version[]
Definition: fileop.c:134
static int init_retval
Definition: papi.c:78
#define DEBUG_OVERFLOW
Definition: papi_debug.h:32
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
#define PAPI_LOW_LEVEL_INITED
Definition: fpapi.h:18
int papi_num_components
int _papi_hwi_init_os(void)
Definition: aix.c:1213
int _papi_hwi_init_global(void)
struct papi_vectors * _papi_hwd[]
#define DEBUG_THREADS
Definition: papi_debug.h:30
int init_level
Definition: papi_internal.c:54
long long tmp
Definition: iozone.c:12031
int _papi_hwi_init_global_threads(void)
Definition: threads.c:527
#define PAPI_NOT_INITED
Definition: fpapi.h:17
#define DEBUG_SUBSTRATE
Definition: papi_debug.h:27

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_list_events ( int  EventSet,
int Events,
int number 
)

list the events that are members of an event set

Definition at line 5876 of file papi.c.

5877 {
5878  EventSetInfo_t *ESI;
5879  int i, j;
5880 
5881  if ( *number < 0 )
5883 
5884  if ( ( Events == NULL ) && ( *number > 0 ) )
5886 
5888  if ( !ESI )
5890 
5891  if ( ( Events == NULL ) || ( *number == 0 ) ) {
5892  *number = ESI->NumberOfEvents;
5893  papi_return( PAPI_OK );
5894  }
5895 
5896  for ( i = 0, j = 0; j < ESI->NumberOfEvents; i++ ) {
5897  if ( ( int ) ESI->EventInfoArray[i].event_code != PAPI_NULL ) {
5898  Events[j] = ( int ) ESI->EventInfoArray[i].event_code;
5899  j++;
5900  if ( j == *number )
5901  break;
5902  }
5903  }
5904 
5905  *number = j;
5906 
5907  return ( PAPI_OK );
5908 }
#define PAPI_NULL
Definition: fpapi.h:13
static int Events[NUM_EVENTS]
Definition: init_fini.c:8
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
int i
Definition: fileop.c:140
#define PAPI_ENOEVST
Definition: fpapi.h:116
EventInfo_t * EventInfoArray
int EventSet
int
Definition: iozone.c:18528
unsigned int event_code
long j
Definition: iozone.c:19135
if(gettimeofday(&tp,(struct timezone *) NULL)==-1) perror("gettimeofday")

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_list_threads ( unsigned long tids,
int number 
)

list the thread ids currently known to PAPI

Definition at line 281 of file papi.c.

282 {
284  int retval;
285 
286  /* If tids == NULL, then just count the threads, don't gather a list. */
287  /* If tids != NULL, then we need the length of the tids array in num. */
288 
289  if ( ( number == NULL ) || ( tids && ( *number <= 0 ) ) )
291 
292  memset( &tmp, 0x0, sizeof ( tmp ) );
293 
294  /* data == NULL, since we don't want the thread specific pointers. */
295  /* tids may be NULL, if the user doesn't want the thread IDs. */
296 
297  tmp.num = *number;
298  tmp.id = tids;
299  tmp.data = NULL;
300 
301  retval = _papi_hwi_gather_all_thrspec_data( 0, &tmp );
302  if ( retval == PAPI_OK )
303  *number = tmp.num;
304 
305  papi_return( retval );
306 }
memset(eventId, 0, size)
void ** data
Definition: papi.h:560
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_thread_id_t * id
Definition: papi.h:559
int _papi_hwi_gather_all_thrspec_data(int tag, PAPI_all_thr_spec_t *where)
Definition: threads.c:554
ssize_t retval
Definition: libasync.c:338
long long tmp
Definition: iozone.c:12031

Here is the call graph for this function:

int PAPI_lock ( int  )

lock one of two PAPI internal user mutex variables

Definition at line 6275 of file papi.c.

6276 {
6277  if ( ( lck < 0 ) || ( lck >= PAPI_NUM_LOCK ) )
6279 
6280  papi_return( _papi_hwi_lock( lck ) );
6281 }
#define PAPI_NUM_LOCK
Definition: papi.h:333
#define papi_return(a)
Definition: papi.c:47
return PAPI_EINVAL
Definition: linux-nvml.c:408
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64

Here is the call graph for this function:

Here is the caller graph for this function:

initialize multiplex support in the PAPI library

Definition at line 2897 of file papi.c.

2898 {
2899  int retval;
2900 
2901  retval = mpx_init( _papi_os_info.itimer_ns );
2902  papi_return( retval );
2903 }
#define papi_return(a)
Definition: papi.c:47
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
int mpx_init(int interval_ns)
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

return the number of hardware counters for a specified component

Definition at line 3865 of file papi.c.

3866 {
3867  return ( PAPI_get_cmp_opt( PAPI_MAX_HWCTRS, NULL, cidx ) );
3868 }
#define PAPI_MAX_HWCTRS
Definition: fpapi.h:58
int PAPI_get_cmp_opt(int option, PAPI_option_t *ptr, int cidx)
Definition: papi.c:4233
static int cidx
Definition: event_info.c:40

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_num_events ( int  EventSet)

return the number of events in an event set

Definition at line 4323 of file papi.c.

4324 {
4325  EventSetInfo_t *ESI;
4326 
4328  if ( !ESI )
4330 
4331 #ifdef DEBUG
4332  /* Not necessary */
4333  if ( ESI->NumberOfEvents == 0 )
4335 #endif
4336 
4337  return ( ESI->NumberOfEvents );
4338 }
#define papi_return(a)
Definition: papi.c:47
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_ENOEVST
Definition: fpapi.h:116
int EventSet

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_overflow ( int  EventSet,
int  EventCode,
int  threshold,
int  flags,
PAPI_overflow_handler_t  handler 
)

set up an event set to begin registering overflows

< Using Hardware

< Force using Software

Definition at line 4668 of file papi.c.

4670 {
4671  int retval, cidx, index, i;
4672  EventSetInfo_t *ESI;
4673 
4675  if ( ESI == NULL ) {
4676  OVFDBG("No EventSet\n");
4678  }
4679 
4680  cidx = valid_ESI_component( ESI );
4681  if ( cidx < 0 ) {
4682  OVFDBG("Component Error\n");
4683  papi_return( cidx );
4684  }
4685 
4686  if ( ( ESI->state & PAPI_STOPPED ) != PAPI_STOPPED ) {
4687  OVFDBG("Already running\n");
4689  }
4690 
4691  if ( ESI->state & PAPI_ATTACHED ) {
4692  OVFDBG("Attached\n");
4694  }
4695 
4696  if ( ESI->state & PAPI_CPU_ATTACHED ) {
4697  OVFDBG("CPU attached\n");
4699  }
4700 
4701  if ( ( index = _papi_hwi_lookup_EventCodeIndex( ESI,
4702  ( unsigned int ) EventCode ) ) < 0 ) {
4704  }
4705 
4706  if ( threshold < 0 ) {
4707  OVFDBG("Threshold below zero\n");
4709  }
4710 
4711  /* We do not support derived events in overflow */
4712  /* Unless it's DERIVED_CMPD in which no calculations are done */
4713 
4714  if ( !( flags & PAPI_OVERFLOW_FORCE_SW ) && threshold != 0 &&
4715  ( ESI->EventInfoArray[index].derived ) &&
4716  ( ESI->EventInfoArray[index].derived != DERIVED_CMPD ) ) {
4717  OVFDBG("Derived event in overflow\n");
4719  }
4720 
4721  /* the first time to call PAPI_overflow function */
4722 
4723  if ( !( ESI->state & PAPI_OVERFLOWING ) ) {
4724  if ( handler == NULL ) {
4725  OVFDBG("NULL handler\n");
4727  }
4728  if ( threshold == 0 ) {
4729  OVFDBG("Zero threshold\n");
4731  }
4732  }
4733  if ( threshold > 0 &&
4734  ESI->overflow.event_counter >= _papi_hwd[cidx]->cmp_info.num_cntrs )
4736 
4737  if ( threshold == 0 ) {
4738  for ( i = 0; i < ESI->overflow.event_counter; i++ ) {
4739  if ( ESI->overflow.EventCode[i] == EventCode )
4740  break;
4741  }
4742  /* EventCode not found */
4743  if ( i == ESI->overflow.event_counter )
4745  /* compact these arrays */
4746  while ( i < ESI->overflow.event_counter - 1 ) {
4747  ESI->overflow.deadline[i] = ESI->overflow.deadline[i + 1];
4748  ESI->overflow.threshold[i] = ESI->overflow.threshold[i + 1];
4749  ESI->overflow.EventIndex[i] = ESI->overflow.EventIndex[i + 1];
4750  ESI->overflow.EventCode[i] = ESI->overflow.EventCode[i + 1];
4751  i++;
4752  }
4753  ESI->overflow.deadline[i] = 0;
4754  ESI->overflow.threshold[i] = 0;
4755  ESI->overflow.EventIndex[i] = 0;
4756  ESI->overflow.EventCode[i] = 0;
4757  ESI->overflow.event_counter--;
4758  } else {
4759  if ( ESI->overflow.event_counter > 0 ) {
4760  if ( ( flags & PAPI_OVERFLOW_FORCE_SW ) &&
4763  if ( !( flags & PAPI_OVERFLOW_FORCE_SW ) &&
4764  ( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) )
4766  }
4767  for ( i = 0; i < ESI->overflow.event_counter; i++ ) {
4768  if ( ESI->overflow.EventCode[i] == EventCode )
4769  break;
4770  }
4771  /* A new entry */
4772  if ( i == ESI->overflow.event_counter ) {
4773  ESI->overflow.EventCode[i] = EventCode;
4774  ESI->overflow.event_counter++;
4775  }
4776  /* New or existing entry */
4777  ESI->overflow.deadline[i] = threshold;
4778  ESI->overflow.threshold[i] = threshold;
4779  ESI->overflow.EventIndex[i] = index;
4780  ESI->overflow.flags = flags;
4781 
4782  }
4783 
4784  /* If overflowing is already active, we should check to
4785  make sure that we don't specify a different handler
4786  or different flags here. You can't mix them. */
4787 
4788  ESI->overflow.handler = handler;
4789 
4790  /* Set up the option structure for the low level.
4791  If we have hardware interrupts and we are not using
4792  forced software emulated interrupts */
4793 
4794  if ( _papi_hwd[cidx]->cmp_info.hardware_intr &&
4795  !( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) ) {
4796  retval = _papi_hwd[cidx]->set_overflow( ESI, index, threshold );
4797  if ( retval == PAPI_OK )
4799  else {
4800  papi_return( retval ); /* We should undo stuff here */
4801  }
4802  } else {
4803  /* Make sure hardware overflow is not set */
4804  ESI->overflow.flags &= ~( PAPI_OVERFLOW_HARDWARE );
4805  }
4806 
4807  APIDBG( "Overflow using: %s\n",
4808  ( ESI->overflow.
4809  flags & PAPI_OVERFLOW_HARDWARE ? "[Hardware]" : ESI->overflow.
4810  flags & PAPI_OVERFLOW_FORCE_SW ? "[Forced Software]" :
4811  "[Software]" ) );
4812 
4813  /* Toggle the overflow flags and ESI state */
4814 
4815  if ( ESI->overflow.event_counter >= 1 )
4816  ESI->state |= PAPI_OVERFLOWING;
4817  else {
4818  ESI->state ^= PAPI_OVERFLOWING;
4819  ESI->overflow.flags = 0;
4820  ESI->overflow.handler = NULL;
4821  }
4822 
4823  return PAPI_OK;
4824 }
long long flags
Definition: iozone.c:12330
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOEVNT
Definition: fpapi.h:112
#define PAPI_EISRUN
Definition: fpapi.h:115
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_STOPPED
Definition: fpapi.h:29
#define DERIVED_CMPD
Definition: papi_internal.h:73
#define PAPI_OVERFLOWING
Definition: fpapi.h:33
#define PAPI_ECNFLCT
Definition: fpapi.h:113
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define PAPI_OVERFLOW_HARDWARE
Definition: papi.h:410
#define PAPI_ENOEVST
Definition: fpapi.h:116
static int cidx
Definition: event_info.c:40
#define OVFDBG(format, args...)
Definition: papi_debug.h:68
#define PAPI_CPU_ATTACHED
Definition: fpapi.h:37
int _papi_hwi_lookup_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
void handler(int EventSet, void *address, long long overflow_vector, void *context)
Definition: rapl_overflow.c:16
inline_static int valid_ESI_component(EventSetInfo_t *ESI)
Definition: papi.c:89
EventInfo_t * EventInfoArray
int threshold
int EventSet
#define PAPI_OVERFLOW_FORCE_SW
Definition: papi.h:409
#define PAPI_ATTACHED
Definition: fpapi.h:36
struct papi_vectors * _papi_hwd[]
ssize_t retval
Definition: libasync.c:338
PAPI_overflow_handler_t handler

Here is the call graph for this function:

Here is the caller graph for this function:

void PAPI_perror ( char *  msg)

Print a PAPI error message

Definition at line 4533 of file papi.c.

4534 {
4535  char *foo;
4536 
4537  foo = PAPI_strerror( _papi_hwi_errno );
4538  if ( foo == NULL )
4539  return;
4540 
4541  if ( msg )
4542  if ( *msg )
4543  fprintf( stderr, "%s: ", msg );
4544 
4545  fprintf( stderr, "%s\n", foo );
4546 }
int _papi_hwi_errno
Definition: papi_internal.c:58
pthread_attr_t foo
Definition: iozone.c:18592
char * PAPI_strerror(int errorCode)
Definition: papi.c:4483

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_profil ( void buf,
unsigned  bufsiz,
caddr_t  offset,
unsigned  scale,
int  EventSet,
int  EventCode,
int  threshold,
int  flags 
)

generate PC histogram data where hardware counter overflow occurs

Definition at line 5316 of file papi.c.

5319 {
5320  EventSetInfo_t *ESI;
5321  int i;
5322  int retval;
5323 
5325  if ( ESI == NULL )
5327 
5328  /* scale factors are checked for validity in PAPI_sprofil */
5329 
5330  if ( threshold > 0 ) {
5331  PAPI_sprofil_t *prof;
5332 
5333  for ( i = 0; i < ESI->profile.event_counter; i++ ) {
5334  if ( ESI->profile.EventCode[i] == EventCode )
5335  break;
5336  }
5337 
5338  if ( i == ESI->profile.event_counter ) {
5339  prof =
5340  ( PAPI_sprofil_t * ) papi_malloc( sizeof ( PAPI_sprofil_t ) );
5341  memset( prof, 0x0, sizeof ( PAPI_sprofil_t ) );
5342  prof->pr_base = buf;
5343  prof->pr_size = bufsiz;
5344  prof->pr_off = offset;
5345  prof->pr_scale = scale;
5346 
5347  retval =
5348  PAPI_sprofil( prof, 1, EventSet, EventCode, threshold, flags );
5349 
5350  if ( retval != PAPI_OK )
5351  papi_free( prof );
5352  } else {
5353  prof = ESI->profile.prof[i];
5354  prof->pr_base = buf;
5355  prof->pr_size = bufsiz;
5356  prof->pr_off = offset;
5357  prof->pr_scale = scale;
5358  retval =
5359  PAPI_sprofil( prof, 1, EventSet, EventCode, threshold, flags );
5360  }
5361  papi_return( retval );
5362  }
5363 
5364  for ( i = 0; i < ESI->profile.event_counter; i++ ) {
5365  if ( ESI->profile.EventCode[i] == EventCode )
5366  break;
5367  }
5368  /* EventCode not found */
5369  if ( i == ESI->profile.event_counter )
5371 
5372  papi_free( ESI->profile.prof[i] );
5373  ESI->profile.prof[i] = NULL;
5374 
5375  papi_return( PAPI_sprofil( NULL, 0, EventSet, EventCode, 0, flags ) );
5376 }
memset(eventId, 0, size)
long long flags
Definition: iozone.c:12330
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_return(a)
Definition: papi.c:47
#define papi_malloc(a)
Definition: papi_memory.h:34
off64_t offset
Definition: iozone.c:1279
caddr_t pr_off
Definition: papi.h:580
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
int PAPI_sprofil(PAPI_sprofil_t *prof, int profcnt, int EventSet, int EventCode, int threshold, int flags)
Definition: papi.c:4923
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
unsigned pr_scale
Definition: papi.h:581
unsigned pr_size
Definition: papi.h:579
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
#define PAPI_ENOEVST
Definition: fpapi.h:116
PAPI_sprofil_t ** prof
int threshold
int EventSet
void * pr_base
Definition: papi.h:578
EventSetProfileInfo_t profile
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_query_event ( int  EventCode)

query if a PAPI event exists

Definition at line 696 of file papi.c.

697 {
698  APIDBG( "Entry: EventCode: %#x\n", EventCode);
699  if ( IS_PRESET(EventCode) ) {
700  EventCode &= PAPI_PRESET_AND_MASK;
701  if ( EventCode >= PAPI_MAX_PRESET_EVENTS )
703 
704  if ( _papi_hwi_presets[EventCode].count )
706  else
707  return PAPI_ENOEVNT;
708  }
709 
710  if ( IS_NATIVE(EventCode) ) {
712  ( ( unsigned int ) EventCode ) );
713  }
714 
715  if ( IS_USER_DEFINED(EventCode) ) {
716  EventCode &= PAPI_UE_AND_MASK;
717  if ( EventCode < 0 || EventCode > (int)_papi_user_events_count)
718  return ( PAPI_EINVAL );
719 
720  papi_return( PAPI_OK );
721  }
722 
724 }
#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)
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define IS_NATIVE(EventCode)
Definition: papi.h:226
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
#define PAPI_ENOTPRESET
Definition: fpapi.h:117
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_query_named_event ( char *  EventName)

query if a named PAPI event exists

Definition at line 765 of file papi.c.

766 {
767  int ret, code;
768 
769  ret = PAPI_event_name_to_code( EventName, &code );
770  if ( ret == PAPI_OK ) ret = PAPI_query_event( code );
771  papi_return( ret);
772 }
#define papi_return(a)
Definition: papi.c:47
return PAPI_OK
Definition: linux-nvml.c:458
long long ret
Definition: iozone.c:1346
int PAPI_event_name_to_code(char *in, int *out)
Definition: papi.c:1008
int PAPI_query_event(int EventCode)
Definition: papi.c:696

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_read ( int  EventSet,
long long values 
)

read hardware events from an event set with no reset

Definition at line 2476 of file papi.c.

2477 {
2478  EventSetInfo_t *ESI;
2479  hwd_context_t *context;
2480  int cidx, retval = PAPI_OK;
2481 
2482  APIDBG( "Entry: EventSet: %d\n", EventSet );
2484  if ( ESI == NULL )
2486 
2487  cidx = valid_ESI_component( ESI );
2488  if ( cidx < 0 )
2489  papi_return( cidx );
2490 
2491  if ( values == NULL )
2493 
2494  if ( ESI->state & PAPI_RUNNING ) {
2495  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2496  retval = MPX_read( ESI->multiplex.mpx_evset, values, 0 );
2497  } else {
2498  /* get the context we should use for this event set */
2499  context = _papi_hwi_get_context( ESI, NULL );
2500  retval = _papi_hwi_read( context, ESI, values );
2501  }
2502  if ( retval != PAPI_OK )
2503  papi_return( retval );
2504  } else {
2505  memcpy( values, ESI->sw_stop,
2506  ( size_t ) ESI->NumberOfEvents * sizeof ( long long ) );
2507  }
2508 
2509 #if defined(DEBUG)
2510  if ( ISLEVEL( DEBUG_API ) ) {
2511  int i;
2512  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2513  APIDBG( "PAPI_read values[%d]:\t%lld\n", i, values[i] );
2514  }
2515  }
2516 #endif
2517 
2518  APIDBG( "PAPI_read returns %d\n", retval );
2519  return ( PAPI_OK );
2520 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define papi_return(a)
Definition: papi.c:47
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_RUNNING
Definition: fpapi.h:30
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define DEBUG_API
Definition: papi_debug.h:28
int MPX_read(MPX_EventSet *mpx_events, long long *values, int called_by_stop)
Definition: sw_multiplex.c:823
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define PAPI_ENOEVST
Definition: fpapi.h:116
static int cidx
Definition: event_info.c:40
int _papi_hwi_read(hwd_context_t *context, EventSetInfo_t *ESI, long long *values)
inline_static int valid_ESI_component(EventSetInfo_t *ESI)
Definition: papi.c:89
again struct sockaddr sizeof(struct sockaddr_in))
EventSetMultiplexInfo_t multiplex
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
int EventSet
long long * sw_stop
#define ISLEVEL(a)
Definition: papi_debug.h:54
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_read_ts ( int  EventSet,
long long values,
long long cyc 
)

read from an eventset with a real-time cycle timestamp

Definition at line 2565 of file papi.c.

2566 {
2567  EventSetInfo_t *ESI;
2568  hwd_context_t *context;
2569  int cidx, retval = PAPI_OK;
2570 
2571  APIDBG( "Entry: EventSet: %d\n", EventSet );
2573  if ( ESI == NULL )
2575 
2576  cidx = valid_ESI_component( ESI );
2577  if ( cidx < 0 )
2578  papi_return( cidx );
2579 
2580  if ( values == NULL )
2582 
2583  if ( ESI->state & PAPI_RUNNING ) {
2584  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2585  retval = MPX_read( ESI->multiplex.mpx_evset, values, 0 );
2586  } else {
2587  /* get the context we should use for this event set */
2588  context = _papi_hwi_get_context( ESI, NULL );
2589  retval = _papi_hwi_read( context, ESI, values );
2590  }
2591  if ( retval != PAPI_OK )
2592  papi_return( retval );
2593  } else {
2594  memcpy( values, ESI->sw_stop,
2595  ( size_t ) ESI->NumberOfEvents * sizeof ( long long ) );
2596  }
2597 
2598  *cycles = _papi_os_vector.get_real_cycles( );
2599 
2600 #if defined(DEBUG)
2601  if ( ISLEVEL( DEBUG_API ) ) {
2602  int i;
2603  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2604  APIDBG( "PAPI_read values[%d]:\t%lld\n", i, values[i] );
2605  }
2606  }
2607 #endif
2608 
2609  APIDBG( "PAPI_read_ts returns %d\n", retval );
2610  return PAPI_OK;
2611 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define papi_return(a)
Definition: papi.c:47
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_RUNNING
Definition: fpapi.h:30
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define DEBUG_API
Definition: papi_debug.h:28
long long(* get_real_cycles)(void)
Definition: papi_vector.h:61
int MPX_read(MPX_EventSet *mpx_events, long long *values, int called_by_stop)
Definition: sw_multiplex.c:823
#define APIDBG(format, args...)
Definition: papi_debug.h:64
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
int i
Definition: fileop.c:140
#define PAPI_ENOEVST
Definition: fpapi.h:116
static int cidx
Definition: event_info.c:40
int _papi_hwi_read(hwd_context_t *context, EventSetInfo_t *ESI, long long *values)
inline_static int valid_ESI_component(EventSetInfo_t *ESI)
Definition: papi.c:89
again struct sockaddr sizeof(struct sockaddr_in))
EventSetMultiplexInfo_t multiplex
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
int EventSet
long long * sw_stop
#define ISLEVEL(a)
Definition: papi_debug.h:54
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:

inform PAPI of the existence of a new thread

Definition at line 203 of file papi.c.

204 {
206 
207  if ( init_level == PAPI_NOT_INITED )
210 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_ENOINIT
Definition: fpapi.h:121
void * thread(void *arg)
Definition: kufrin.c:31
inline_static int _papi_hwi_lookup_or_create_thread(ThreadInfo_t **here, int tid)
Definition: threads.h:145
int init_level
Definition: papi_internal.c:54
#define PAPI_NOT_INITED
Definition: fpapi.h:17

Here is the call graph for this function: