PAPI  5.3.0.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 2653 of file papi.c.

2654 {
2655  EventSetInfo_t *ESI;
2656  hwd_context_t *context;
2657  int i, cidx, retval;
2658  long long a, b, c;
2659 
2661  if ( ESI == NULL )
2663 
2664  cidx = valid_ESI_component( ESI );
2665  if ( cidx < 0 )
2666  papi_return( cidx );
2667 
2668  if ( values == NULL )
2670 
2671  if ( ESI->state & PAPI_RUNNING ) {
2672  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2673  retval = MPX_read( ESI->multiplex.mpx_evset, ESI->sw_stop, 0 );
2674  } else {
2675  /* get the context we should use for this event set */
2676  context = _papi_hwi_get_context( ESI, NULL );
2677  retval = _papi_hwi_read( context, ESI, ESI->sw_stop );
2678  }
2679  if ( retval != PAPI_OK )
2680  papi_return( retval );
2681  }
2682 
2683  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2684  a = ESI->sw_stop[i];
2685  b = values[i];
2686  c = a + b;
2687  values[i] = c;
2688  }
2689 
2691 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
int PAPI_reset(int EventSet)
Definition: papi.c:2370
#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 1597 of file papi.c.

1598 {
1599  APIDBG("Entry: EventSet: %d, EventCode: %#x\n", EventSet, EventCode);
1600  EventSetInfo_t *ESI;
1601 
1602  /* Is the EventSet already in existence? */
1603 
1605  if ( ESI == NULL )
1607 
1608  /* Check argument for validity */
1609 
1610  if ( ( ( EventCode & PAPI_PRESET_MASK ) == 0 ) &&
1611  ( EventCode & PAPI_NATIVE_MASK ) == 0 )
1613 
1614  /* Of course, it must be stopped in order to modify it. */
1615 
1616  if ( ESI->state & PAPI_RUNNING )
1618 
1619  /* Now do the magic. */
1620 
1621  papi_return( _papi_hwi_add_event( ESI, EventCode ) );
1622 }
#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 5707 of file papi.c.

5708 {
5709  int i, retval;
5710 
5711  if ( ( Events == NULL ) || ( number <= 0 ) )
5713 
5714  for ( i = 0; i < number; i++ ) {
5715  retval = PAPI_add_event( EventSet, Events[i] );
5716  if ( retval != PAPI_OK ) {
5717  if ( i == 0 )
5718  papi_return( retval );
5719  else
5720  return ( i );
5721  }
5722  }
5723  return ( PAPI_OK );
5724 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1597
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 1809 of file papi.c.

1810 {
1811  int ret, code;
1812 
1813  ret = PAPI_event_name_to_code( EventName, &code );
1814  if ( ret == PAPI_OK ) ret = PAPI_add_event( EventSet, code );
1815  papi_return( ret );
1816 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1597
#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:1003
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 1460 of file papi.c.

1461 {
1462  EventSetInfo_t *ESI;
1463  int retval;
1464 
1466  if ( ESI == NULL )
1468 
1469 /* validate cidx */
1470  retval = valid_component( cidx );
1471  if ( retval < 0 )
1472  papi_return( retval );
1473 
1474 /* cowardly refuse to reassign eventsets */
1475  if ( ESI->CmpIdx >= 0 )
1476  return PAPI_EINVAL;
1477 
1478  return ( _papi_hwi_assign_eventset( ESI, cidx ) );
1479 }
#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 3100 of file papi.c.

3101 {
3102  return ( _papi_set_attach( PAPI_ATTACH, EventSet, tid ) );
3103 }
inline_static int _papi_set_attach(int option, int EventSet, unsigned long tid)
Definition: papi.c:3039
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 2795 of file papi.c.

2796 {
2797  EventSetInfo_t *ESI;
2798  int i, cidx, total, retval;
2799 
2800  APIDBG("Attempting to cleanup Eventset %d\n",EventSet);
2801 
2802  /* Is the EventSet already in existence? */
2803 
2805  if ( ESI == NULL )
2807 
2808  /* if the eventset has no index and no events, return OK
2809  otherwise return NOCMP */
2810  cidx = valid_ESI_component( ESI );
2811  if ( cidx < 0 ) {
2812  if ( ESI->NumberOfEvents )
2813  papi_return( cidx );
2814  papi_return( PAPI_OK );
2815  }
2816 
2817  /* Of course, it must be stopped in order to modify it. */
2818 
2819  if ( ESI->state & PAPI_RUNNING )
2821 
2822  /* clear overflow flag and turn off hardware overflow handler */
2823  if ( ESI->state & PAPI_OVERFLOWING ) {
2824  total = ESI->overflow.event_counter;
2825  for ( i = 0; i < total; i++ ) {
2826  retval = PAPI_overflow( EventSet,
2827  ESI->overflow.EventCode[0], 0, 0, NULL );
2828  if ( retval != PAPI_OK )
2829  papi_return( retval );
2830  }
2831  }
2832 
2833  /* clear profile flag and turn off hardware profile handler */
2834  if ( ( ESI->state & PAPI_PROFILING ) &&
2835  _papi_hwd[cidx]->cmp_info.hardware_intr &&
2836  !( ESI->profile.flags & PAPI_PROFIL_FORCE_SW ) ) {
2837  total = ESI->profile.event_counter;
2838  for ( i = 0; i < total; i++ ) {
2839  retval =
2840  PAPI_sprofil( NULL, 0, EventSet, ESI->profile.EventCode[0], 0,
2842  if ( retval != PAPI_OK )
2843  papi_return( retval );
2844  }
2845  }
2846 
2847  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2848  retval = MPX_cleanup( &ESI->multiplex.mpx_evset );
2849  if ( retval != PAPI_OK )
2850  papi_return( retval );
2851  }
2852 
2853  retval = _papi_hwd[cidx]->cleanup_eventset( ESI->ctl_state );
2854  if ( retval != PAPI_OK )
2855  papi_return( retval );
2856 
2857  /* Now do the magic */
2859 }
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:4655
#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:4910
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 1399 of file papi.c.

1400 {
1401  APIDBG("Entry: EventSet: %p\n", EventSet);
1402  ThreadInfo_t *master;
1403  int retval;
1404 
1405  if ( init_level == PAPI_NOT_INITED )
1407  retval = _papi_hwi_lookup_or_create_thread( &master, 0 );
1408  if ( retval )
1409  papi_return( retval );
1410 
1412 }
#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 1937 of file papi.c.

1938 {
1939  EventSetInfo_t *ESI;
1940 
1941  APIDBG("Destroying Eventset %d\n",*EventSet);
1942 
1943  /* check for pre-existing ESI */
1944 
1945  if ( EventSet == NULL )
1947 
1949  if ( ESI == NULL )
1951 
1952  if ( !( ESI->state & PAPI_STOPPED ) )
1954 
1955  if ( ESI->NumberOfEvents )
1957 
1959  *EventSet = PAPI_NULL;
1960 
1961  return PAPI_OK;
1962 }
#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 3156 of file papi.c.

3157 {
3158  return ( _papi_set_attach( PAPI_DETACH, EventSet, 0 ) );
3159 }
inline_static int _papi_set_attach(int option, int EventSet, unsigned long tid)
Definition: papi.c:3039
#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 6524 of file papi.c.

6525 {
6526 
6527  const PAPI_component_info_t *cinfo;
6528 
6529  /* Can only run before PAPI_library_init() is called */
6530  if (init_level != PAPI_NOT_INITED) {
6531  return PAPI_ENOINIT;
6532  }
6533 
6534  cinfo=PAPI_get_component_info(cidx);
6535  if (cinfo==NULL) return PAPI_ENOCMP;
6536 
6537  ((PAPI_component_info_t *)cinfo)->disabled=1;
6538  strcpy(((PAPI_component_info_t *)cinfo)->disabled_reason,
6539  "Disabled by PAPI_disable_component()");
6540 
6541  return PAPI_OK;
6542 
6543 }
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:803
#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 6574 of file papi.c.

6575 {
6576  int cidx;
6577 
6578  /* I can only be called before init time */
6579  if (init_level!=PAPI_NOT_INITED) {
6580  return PAPI_ENOINIT;
6581  }
6582 
6584  if (cidx>=0) {
6585  return PAPI_disable_component(cidx);
6586  }
6587 
6588  return PAPI_ENOCMP;
6589 }
#define PAPI_ENOINIT
Definition: fpapi.h:121
#define PAPI_ENOCMP
Definition: fpapi.h:122
int PAPI_disable_component(int cidx)
Definition: papi.c:6524
static int cidx
Definition: event_info.c:40
int PAPI_get_component_index(char *name)
Definition: papi.c:6469
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 1305 of file papi.c.

1306 {
1307  int i = *EventCode;
1308  int retval;
1309  int event_code;
1310 
1311  if ( _papi_hwi_invalid_cmp(cidx) || ( (IS_PRESET(i)) && cidx > 0 ) ) {
1312  return PAPI_ENOCMP;
1313  }
1314 
1315  if (_papi_hwd[cidx]->cmp_info.disabled) {
1316  return PAPI_ENOCMP;
1317  }
1318 
1319  if ( IS_PRESET(i) ) {
1320  if ( modifier == PAPI_ENUM_FIRST ) {
1321  *EventCode = ( int ) PAPI_PRESET_MASK;
1322  return PAPI_OK;
1323  }
1324  i &= PAPI_PRESET_AND_MASK;
1325  while ( ++i < PAPI_MAX_PRESET_EVENTS ) {
1326  if ( _papi_hwi_presets[i].symbol == NULL )
1327  return ( PAPI_ENOEVNT ); /* NULL pointer terminates list */
1328  if ( modifier & PAPI_PRESET_ENUM_AVAIL ) {
1329  if ( _papi_hwi_presets[i].count == 0 )
1330  continue;
1331  }
1332  *EventCode = ( int ) ( i | PAPI_PRESET_MASK );
1333  return PAPI_OK;
1334  }
1335  } else if ( IS_NATIVE(i) ) {
1336 
1337  /* Should we check against num native events here? */
1338  event_code=_papi_hwi_eventcode_to_native(*EventCode);
1339  retval = _papi_hwd[cidx]->ntv_enum_events((unsigned int *)&event_code, modifier );
1340 
1341  if (retval!=PAPI_OK) {
1342  SUBDBG("VMW: retval=%d\n",retval);
1343  return PAPI_EINVAL;
1344  }
1345 
1346  /* re-apply Component ID to the returned Event */
1347  *EventCode = _papi_hwi_native_to_eventcode(cidx,event_code);
1348 
1349  return retval;
1350  }
1351 
1353 }
#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
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 1143 of file papi.c.

1144 {
1145  int i = *EventCode;
1146  int retval;
1147  int cidx;
1148  int event_code;
1149 
1150  cidx = _papi_hwi_component_index( *EventCode );
1151  if (cidx < 0) return PAPI_ENOCMP;
1152 
1153  /* Do we handle presets in componets other than CPU? */
1154  /* if (( IS_PRESET(i) ) && cidx > 0 )) return PAPI_ENOCMP; */
1155 
1156  if ( IS_PRESET(i) ) {
1157  if ( modifier == PAPI_ENUM_FIRST ) {
1158  *EventCode = ( int ) PAPI_PRESET_MASK;
1159  return ( PAPI_OK );
1160  }
1161  i &= PAPI_PRESET_AND_MASK;
1162  while ( ++i < PAPI_MAX_PRESET_EVENTS ) {
1163  if ( _papi_hwi_presets[i].symbol == NULL )
1164  return ( PAPI_ENOEVNT ); /* NULL pointer terminates list */
1165  if ( modifier & PAPI_PRESET_ENUM_AVAIL ) {
1166  if ( _papi_hwi_presets[i].count == 0 )
1167  continue;
1168  }
1169  *EventCode = ( int ) ( i | PAPI_PRESET_MASK );
1170  return ( PAPI_OK );
1171  }
1172  } else if ( IS_NATIVE(i) ) {
1173  /* Should check against num native events here */
1174 
1175  event_code=_papi_hwi_eventcode_to_native((int)*EventCode);
1176  retval = _papi_hwd[cidx]->ntv_enum_events((unsigned int *)&event_code, modifier );
1177 
1178  /* re-apply Component ID to the returned Event */
1179  *EventCode = _papi_hwi_native_to_eventcode(cidx,event_code);
1180 
1181  return retval;
1182  } else if ( IS_USER_DEFINED(i) ) {
1183  if ( modifier == PAPI_ENUM_FIRST ) {
1184  *EventCode = (int) 0x0;
1185  return ( PAPI_OK );
1186  }
1187 
1188  i &= PAPI_UE_AND_MASK;
1189  ++i;
1190 
1191  if ( (int)_papi_user_events_count <= i )
1192  *EventCode = i;
1193  return ( PAPI_OK );
1194  }
1195 
1197 }
#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
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 920 of file papi.c.

921 {
922  if ( out == NULL )
924 
925  if ( IS_PRESET(EventCode) ) {
926  EventCode &= PAPI_PRESET_AND_MASK;
927  if ( ( EventCode >= PAPI_MAX_PRESET_EVENTS )
928  || ( _papi_hwi_presets[EventCode].symbol == NULL ) )
930 
931  strncpy( out, _papi_hwi_presets[EventCode].symbol,
933  papi_return( PAPI_OK );
934  }
935 
936  if ( IS_NATIVE(EventCode) ) {
938  ( ( unsigned int ) EventCode, out, PAPI_MAX_STR_LEN ) );
939  }
940 
941  if ( IS_USER_DEFINED(EventCode) ) {
942  EventCode &= PAPI_UE_AND_MASK;
943 
944  if ( EventCode < 0 || EventCode > (int)_papi_user_events_count )
946 
947  strncpy( out, _papi_user_events[EventCode].symbol,
949  papi_return( PAPI_OK );
950  }
951 
953 }
#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 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 1003 of file papi.c.

1004 {
1005  APIDBG("Entry: in: %p, name: %s, out: %p\n", in, in, out);
1006  int i;
1007 
1008  if ( ( in == NULL ) || ( out == NULL ) )
1010 
1011  if ( init_level == PAPI_NOT_INITED )
1013 
1014  /* All presets start with "PAPI_" so no need to */
1015  /* do an exhaustive search if that's not there */
1016  if (strncmp(in, "PAPI_", 5) == 0) {
1017  for(i = 0; i < PAPI_MAX_PRESET_EVENTS; i++ ) {
1018  if ( ( _papi_hwi_presets[i].symbol )
1019  && ( strcasecmp( _papi_hwi_presets[i].symbol, in ) == 0) ) {
1020  *out = ( int ) ( i | PAPI_PRESET_MASK );
1021  papi_return( PAPI_OK );
1022  }
1023  }
1024  }
1025 
1026  for ( i=0; i < (int)_papi_user_events_count; i++ ) {
1027  if ( strcasecmp( _papi_user_events[i].symbol, in ) == 0 ) {
1028  *out = (int) ( i | PAPI_UE_MASK );
1029  papi_return( PAPI_OK );
1030  }
1031  }
1032 
1034 }
#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 4221 of file papi.c.

4222 {
4223 
4224  if (_papi_hwi_invalid_cmp(cidx)) {
4225  return PAPI_ECMP;
4226  }
4227 
4228  switch ( option ) {
4229  /* For now, MAX_HWCTRS and MAX CTRS are identical.
4230  At some future point, they may map onto different values.
4231  */
4232  case PAPI_MAX_HWCTRS:
4233  return ( _papi_hwd[cidx]->cmp_info.num_cntrs );
4234  case PAPI_MAX_MPX_CTRS:
4235  return ( _papi_hwd[cidx]->cmp_info.num_mpx_cntrs );
4236  case PAPI_DEFDOM:
4237  return ( _papi_hwd[cidx]->cmp_info.default_domain );
4238  case PAPI_DEFGRN:
4239  return ( _papi_hwd[cidx]->cmp_info.default_granularity );
4240  case PAPI_SHLIBINFO:
4241  {
4242  int retval;
4243  if ( ptr == NULL )
4247  papi_return( retval );
4248  }
4249  case PAPI_COMPONENTINFO:
4250  if ( ptr == NULL )
4252  ptr->cmp_info = &( _papi_hwd[cidx]->cmp_info );
4253  return PAPI_OK;
4254  default:
4256  }
4257  return PAPI_OK;
4258 }
#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 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 6469 of file papi.c.

6470 {
6471  int cidx;
6472 
6473  const PAPI_component_info_t *cinfo;
6474 
6475  for(cidx=0;cidx<papi_num_components;cidx++) {
6476 
6477  cinfo=PAPI_get_component_info(cidx);
6478  if (cinfo==NULL) return PAPI_ENOCMP;
6479 
6480  if (!strcmp(name,cinfo->name)) {
6481  return cidx;
6482  }
6483  }
6484 
6485  return PAPI_ENOCMP;
6486 }
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:803
#define PAPI_ENOCMP
Definition: fpapi.h:122
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 803 of file papi.c.

804 {
805  if ( _papi_hwi_invalid_cmp( cidx ) )
806  return ( NULL );
807  else
808  return ( &( _papi_hwd[cidx]->cmp_info ) );
809 }
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 5924 of file papi.c.

5925 {
5926  if ( dest == NULL )
5927  return PAPI_EINVAL;
5928 
5929  memset( ( void * ) dest, 0x0, sizeof ( PAPI_dmem_info_t ) );
5930  return ( _papi_os_vector.get_dmem_info( dest ) );
5931 }
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 6443 of file papi.c.

6444 {
6445  return _papi_hwi_component_index( EventCode);
6446 }
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 841 of file papi.c.

842 {
843  int i;
844 
845  if ( info == NULL )
847 
848  if ( IS_PRESET(EventCode) ) {
849  i = EventCode & PAPI_PRESET_AND_MASK;
850  if ( i >= PAPI_MAX_PRESET_EVENTS )
852  papi_return( _papi_hwi_get_preset_event_info( EventCode, info ) );
853  }
854 
855  if ( IS_NATIVE(EventCode) ) {
857  ( ( unsigned int ) EventCode, info ) );
858  }
859 
860  if ( IS_USER_DEFINED(EventCode) ) {
861  papi_return( PAPI_OK );
862  }
864 }
#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
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 1503 of file papi.c.

1504 {
1505  EventSetInfo_t *ESI;
1506  int retval;
1507 
1508 /* validate eventset */
1510  if ( ESI == NULL )
1512 
1513 /* check if a component has been assigned */
1514  if ( ESI->CmpIdx < 0 )
1516 
1517 /* validate CmpIdx */
1518  retval = valid_component( ESI->CmpIdx );
1519  if ( retval < 0 )
1520  papi_return( retval );
1521 
1522 /* return the index */
1523  return ( ESI->CmpIdx );
1524 }
#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 5975 of file papi.c.

5976 {
5978  int retval;
5979 
5980  memset( &ptr, 0, sizeof ( ptr ) );
5981  retval = PAPI_get_opt( PAPI_EXEINFO, &ptr );
5982  if ( retval == PAPI_OK )
5983  return ( ptr.exe_info );
5984  else
5985  return ( NULL );
5986 }
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:4030
#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 6046 of file papi.c.

6047 {
6049  int retval;
6050 
6051  memset( &ptr, 0, sizeof ( ptr ) );
6052  retval = PAPI_get_opt( PAPI_HWINFO, &ptr );
6053  if ( retval == PAPI_OK )
6054  return ( ptr.hw_info );
6055  else
6056  return ( NULL );
6057 }
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:4030
#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 3916 of file papi.c.

3917 {
3918  PAPI_option_t popt;
3919  int retval;
3920 
3921  popt.multiplex.eventset = EventSet;
3922  retval = PAPI_get_opt( PAPI_MULTIPLEX, &popt );
3923  if ( retval < 0 )
3924  retval = 0;
3925  return retval;
3926 }
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:4030
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 4030 of file papi.c.

4031 {
4032  EventSetInfo_t *ESI;
4033 
4034  if ( ( option != PAPI_DEBUG ) && ( init_level == PAPI_NOT_INITED ) )
4036 
4037  switch ( option ) {
4038  case PAPI_DETACH:
4039  {
4040  if ( ptr == NULL )
4043  if ( ESI == NULL )
4045  ptr->attach.tid = ESI->attach.tid;
4046  return ( ( ESI->state & PAPI_ATTACHED ) == 0 );
4047  }
4048  case PAPI_ATTACH:
4049  {
4050  if ( ptr == NULL )
4053  if ( ESI == NULL )
4055  ptr->attach.tid = ESI->attach.tid;
4056  return ( ( ESI->state & PAPI_ATTACHED ) != 0 );
4057  }
4058  case PAPI_CPU_ATTACH:
4059  {
4060  if ( ptr == NULL )
4063  if ( ESI == NULL )
4065  ptr->cpu.cpu_num = ESI->CpuInfo->cpu_num;
4066  return ( ( ESI->state & PAPI_CPU_ATTACHED ) != 0 );
4067  }
4068  case PAPI_DEF_MPX_NS:
4069  {
4070  /* xxxx for now, assume we only check against cpu component */
4071  if ( ptr == NULL )
4074  return ( PAPI_OK );
4075  }
4076  case PAPI_DEF_ITIMER_NS:
4077  {
4078  /* xxxx for now, assume we only check against cpu component */
4079  if ( ptr == NULL )
4082  return ( PAPI_OK );
4083  }
4084  case PAPI_DEF_ITIMER:
4085  {
4086  /* xxxx for now, assume we only check against cpu component */
4087  if ( ptr == NULL )
4092  ptr->itimer.flags = 0;
4093  return ( PAPI_OK );
4094  }
4095  case PAPI_MULTIPLEX:
4096  {
4097  if ( ptr == NULL )
4100  if ( ESI == NULL )
4102  ptr->multiplex.ns = ESI->multiplex.ns;
4103  ptr->multiplex.flags = ESI->multiplex.flags;
4104  return ( ESI->state & PAPI_MULTIPLEXING ) != 0;
4105  }
4106  case PAPI_PRELOAD:
4107  if ( ptr == NULL )
4109  memcpy( &ptr->preload, &_papi_hwi_system_info.preload_info,
4111  break;
4112  case PAPI_DEBUG:
4113  if ( ptr == NULL )
4117  break;
4118  case PAPI_CLOCKRATE:
4119  return ( ( int ) _papi_hwi_system_info.hw_info.cpu_max_mhz );
4120  case PAPI_MAX_CPUS:
4121  return ( _papi_hwi_system_info.hw_info.ncpu );
4122  /* For now, MAX_HWCTRS and MAX CTRS are identical.
4123  At some future point, they may map onto different values.
4124  */
4125  case PAPI_INHERIT:
4126  {
4127  if ( ptr == NULL )
4130  if ( ESI == NULL )
4132  ptr->inherit.inherit = ESI->inherit.inherit;
4133  return ( PAPI_OK );
4134  }
4135  case PAPI_GRANUL:
4136  if ( ptr == NULL )
4139  if ( ESI == NULL )
4142  break;
4143  case PAPI_EXEINFO:
4144  if ( ptr == NULL )
4147  break;
4148  case PAPI_HWINFO:
4149  if ( ptr == NULL )
4152  break;
4153 
4154  case PAPI_DOMAIN:
4155  if ( ptr == NULL )
4158  if ( ESI == NULL )
4160  ptr->domain.domain = ESI->domain.domain;
4161  return ( PAPI_OK );
4162  case PAPI_LIB_VERSION:
4163  return ( PAPI_VERSION );
4164 /* The following cases all require a component index
4165  and are handled by PAPI_get_cmp_opt() with cidx == 0*/
4166  case PAPI_MAX_HWCTRS:
4167  case PAPI_MAX_MPX_CTRS:
4168  case PAPI_DEFDOM:
4169  case PAPI_DEFGRN:
4170  case PAPI_SHLIBINFO:
4171  case PAPI_COMPONENTINFO:
4172  return ( PAPI_get_cmp_opt( option, ptr, 0 ) );
4173  default:
4175  }
4176  return ( PAPI_OK );
4177 }
#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 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:4221
#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 6378 of file papi.c.

6380 {
6381  EventSetInfo_t *ESI;
6382  int set_bit, j, pos;
6383  int count = 0, k;
6384 
6385  if ( overflow_vector == ( long long ) 0 )
6387 
6388  if ( ( array == NULL ) || ( number == NULL ) )
6390 
6391  if ( *number < 1 )
6393 
6395  if ( ESI == NULL )
6397 
6398  /* in case the eventset is empty */
6399  if ( ESI->NumberOfEvents == 0 )
6401 
6402  while ( ( set_bit = ffsll( overflow_vector ) ) ) {
6403  set_bit -= 1;
6404  overflow_vector ^= ( long long ) 1 << set_bit;
6405  for ( j = 0; j < ESI->NumberOfEvents; j++ ) {
6406  for ( k = 0, pos = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT && pos >= 0; k++ ) {
6407  pos = ESI->EventInfoArray[j].pos[k];
6408  if ( ( set_bit == pos ) &&
6409  ( ( ESI->EventInfoArray[j].derived == NOT_DERIVED ) ||
6410  ( ESI->EventInfoArray[j].derived == DERIVED_CMPD ) ) ) {
6411  array[count++] = j;
6412  if ( count == *number )
6413  return PAPI_OK;
6414 
6415  break;
6416  }
6417  }
6418  }
6419  }
6420  *number = count;
6421  return PAPI_OK;
6422 }
#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 6078 of file papi.c.

6079 {
6080  return ( _papi_os_vector.get_real_cycles( ) );
6081 }
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 6098 of file papi.c.

6099 {
6100  return ( ( _papi_os_vector.get_real_nsec( )));
6101 
6102 }
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 6125 of file papi.c.

6126 {
6127  return ( _papi_os_vector.get_real_usec( ) );
6128 }
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 6005 of file papi.c.

6006 {
6008  int retval;
6009 
6010  memset( &ptr, 0, sizeof ( ptr ) );
6011  retval = PAPI_get_opt( PAPI_SHLIBINFO, &ptr );
6012  if ( retval == PAPI_OK )
6013  return ( ptr.shlib_info );
6014  else
6015  return ( NULL );
6016 }
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:4030
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 6161 of file papi.c.

6162 {
6163 
6164  return ( ( long long ) _papi_os_vector.get_virt_cycles( ) );
6165 }
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 6191 of file papi.c.

6192 {
6193 
6194  return ( ( _papi_os_vector.get_virt_nsec()));
6195 
6196 }
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 6233 of file papi.c.

6234 {
6235 
6236  return ( ( long long ) _papi_os_vector.get_virt_usec() );
6237 }
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 6324 of file papi.c.

6325 {
6326  return ( init_level );
6327 }
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  char *filename;
498  int tmp = 0, tmpel;
499 
500  /* This is a poor attempt at a lock.
501  For 3.1 this should be replaced with a
502  true UNIX semaphore. We cannot use PAPI
503  locks here because they are not initialized yet */
504  static int _in_papi_library_init_cnt = 0;
505 #ifdef DEBUG
506  char *var;
507 #endif
509 
510  if ( version != PAPI_VER_CURRENT )
512 
513  ++_in_papi_library_init_cnt;
514  while ( _in_papi_library_init_cnt > 1 ) {
515  PAPIERROR( "Multiple callers of PAPI_library_init" );
516  sleep( 1 );
517  }
518 
519  /* This checks to see if we have forked or called init more than once.
520  If we have forked, then we continue to init. If we have not forked,
521  we check to see the status of initialization. */
522 
523  APIDBG( "Initializing library: current PID %d, old PID %d\n",
524  getpid( ), _papi_hwi_system_info.pid );
525 
526  if ( _papi_hwi_system_info.pid == getpid( ) ) {
527  /* If the magic environment variable PAPI_ALLOW_STOLEN is set,
528  we call shutdown if PAPI has been initialized. This allows
529  tools that use LD_PRELOAD to run on applications that use PAPI.
530  In this circumstance, PAPI_ALLOW_STOLEN will be set to 'stolen'
531  so the tool can check for this case. */
532 
533  if ( getenv( "PAPI_ALLOW_STOLEN" ) ) {
534  char buf[PAPI_HUGE_STR_LEN];
535  if ( init_level != PAPI_NOT_INITED )
536  PAPI_shutdown( );
537  sprintf( buf, "%s=%s", "PAPI_ALLOW_STOLEN", "stolen" );
538  putenv( buf );
539  }
540 
541  /* If the library has been successfully initialized *OR*
542  the library attempted initialization but failed. */
543 
544  else if ( ( init_level != PAPI_NOT_INITED ) ||
545  ( init_retval != DEADBEEF ) ) {
546  _in_papi_library_init_cnt--;
547  if ( init_retval < PAPI_OK )
549  else
550  return ( init_retval );
551  }
552 
553  APIDBG( "system_info was initialized, but init did not succeed\n" );
554  }
555 #ifdef DEBUG
556  var = ( char * ) getenv( "PAPI_DEBUG" );
557  _papi_hwi_debug = 0;
558 
559  if ( var != NULL ) {
560  if ( strlen( var ) != 0 ) {
561  if ( strstr( var, "SUBSTRATE" ) )
563  if ( strstr( var, "API" ) )
565  if ( strstr( var, "INTERNAL" ) )
567  if ( strstr( var, "THREADS" ) )
569  if ( strstr( var, "MULTIPLEX" ) )
571  if ( strstr( var, "OVERFLOW" ) )
573  if ( strstr( var, "PROFILE" ) )
575  if ( strstr( var, "MEMORY" ) )
577  if ( strstr( var, "LEAK" ) )
579  if ( strstr( var, "ALL" ) )
581  }
582 
583  if ( _papi_hwi_debug == 0 )
585  }
586 #endif
587 
588  /* Be verbose for now */
589 
590  tmpel = _papi_hwi_error_level;
592 
593  /* Initialize internal globals */
595  _in_papi_library_init_cnt--;
596  _papi_hwi_error_level = tmpel;
598  }
599 
600  /* Initialize OS */
601  tmp = _papi_hwi_init_os();
602  if ( tmp ) {
603  init_retval = tmp;
605  _in_papi_library_init_cnt--;
606  _papi_hwi_error_level = tmpel;
608  }
609 
610  /* Initialize component globals */
611 
612  tmp = _papi_hwi_init_global( );
613  if ( tmp ) {
614  init_retval = tmp;
616  _in_papi_library_init_cnt--;
617  _papi_hwi_error_level = tmpel;
619  }
620 
621  /* Initialize thread globals, including the main threads */
622 
624  if ( tmp ) {
625  int i;
626  init_retval = tmp;
628  for ( i = 0; i < papi_num_components; i++ ) {
629  if (!_papi_hwd[i]->cmp_info.disabled) {
630  _papi_hwd[i]->shutdown_component( );
631  }
632  }
633  _in_papi_library_init_cnt--;
634  _papi_hwi_error_level = tmpel;
636  }
637 
639  _in_papi_library_init_cnt--;
640  _papi_hwi_error_level = tmpel;
641 
642 #ifdef STATIC_USER_EVENTS
644 #endif
645 
646  if ( (filename = getenv( "PAPI_USER_EVENTS_FILE" )) != NULL ) {
648  }
649 
650  return ( init_retval = PAPI_VER_CURRENT );
651 }
#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:4344
#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 5863 of file papi.c.

5864 {
5865  EventSetInfo_t *ESI;
5866  int i, j;
5867 
5868  if ( *number < 0 )
5870 
5871  if ( ( Events == NULL ) && ( *number > 0 ) )
5873 
5875  if ( !ESI )
5877 
5878  if ( ( Events == NULL ) || ( *number == 0 ) ) {
5879  *number = ESI->NumberOfEvents;
5880  papi_return( PAPI_OK );
5881  }
5882 
5883  for ( i = 0, j = 0; j < ESI->NumberOfEvents; i++ ) {
5884  if ( ( int ) ESI->EventInfoArray[i].event_code != PAPI_NULL ) {
5885  Events[j] = ( int ) ESI->EventInfoArray[i].event_code;
5886  j++;
5887  if ( j == *number )
5888  break;
5889  }
5890  }
5891 
5892  *number = j;
5893 
5894  return ( PAPI_OK );
5895 }
#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 6262 of file papi.c.

6263 {
6264  if ( ( lck < 0 ) || ( lck >= PAPI_NUM_LOCK ) )
6266 
6267  papi_return( _papi_hwi_lock( lck ) );
6268 }
#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 2887 of file papi.c.

2888 {
2889  int retval;
2890 
2891  retval = mpx_init( _papi_os_info.itimer_ns );
2892  papi_return( retval );
2893 }
#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 3854 of file papi.c.

3855 {
3856  return ( PAPI_get_cmp_opt( PAPI_MAX_HWCTRS, NULL, cidx ) );
3857 }
#define PAPI_MAX_HWCTRS
Definition: fpapi.h:58
int PAPI_get_cmp_opt(int option, PAPI_option_t *ptr, int cidx)
Definition: papi.c:4221
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 4310 of file papi.c.

4311 {
4312  EventSetInfo_t *ESI;
4313 
4315  if ( !ESI )
4317 
4318 #ifdef DEBUG
4319  /* Not necessary */
4320  if ( ESI->NumberOfEvents == 0 )
4322 #endif
4323 
4324  return ( ESI->NumberOfEvents );
4325 }
#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 4655 of file papi.c.

4657 {
4658  int retval, cidx, index, i;
4659  EventSetInfo_t *ESI;
4660 
4662  if ( ESI == NULL ) {
4663  OVFDBG("No EventSet\n");
4665  }
4666 
4667  cidx = valid_ESI_component( ESI );
4668  if ( cidx < 0 ) {
4669  OVFDBG("Component Error\n");
4670  papi_return( cidx );
4671  }
4672 
4673  if ( ( ESI->state & PAPI_STOPPED ) != PAPI_STOPPED ) {
4674  OVFDBG("Already running\n");
4676  }
4677 
4678  if ( ESI->state & PAPI_ATTACHED ) {
4679  OVFDBG("Attached\n");
4681  }
4682 
4683  if ( ESI->state & PAPI_CPU_ATTACHED ) {
4684  OVFDBG("CPU attached\n");
4686  }
4687 
4688  if ( ( index = _papi_hwi_lookup_EventCodeIndex( ESI,
4689  ( unsigned int ) EventCode ) ) < 0 ) {
4691  }
4692 
4693  if ( threshold < 0 ) {
4694  OVFDBG("Threshold below zero\n");
4696  }
4697 
4698  /* We do not support derived events in overflow */
4699  /* Unless it's DERIVED_CMPD in which no calculations are done */
4700 
4701  if ( !( flags & PAPI_OVERFLOW_FORCE_SW ) && threshold != 0 &&
4702  ( ESI->EventInfoArray[index].derived ) &&
4703  ( ESI->EventInfoArray[index].derived != DERIVED_CMPD ) ) {
4704  OVFDBG("Derived event in overflow\n");
4706  }
4707 
4708  /* the first time to call PAPI_overflow function */
4709 
4710  if ( !( ESI->state & PAPI_OVERFLOWING ) ) {
4711  if ( handler == NULL ) {
4712  OVFDBG("NULL handler\n");
4714  }
4715  if ( threshold == 0 ) {
4716  OVFDBG("Zero threshold\n");
4718  }
4719  }
4720  if ( threshold > 0 &&
4721  ESI->overflow.event_counter >= _papi_hwd[cidx]->cmp_info.num_cntrs )
4723 
4724  if ( threshold == 0 ) {
4725  for ( i = 0; i < ESI->overflow.event_counter; i++ ) {
4726  if ( ESI->overflow.EventCode[i] == EventCode )
4727  break;
4728  }
4729  /* EventCode not found */
4730  if ( i == ESI->overflow.event_counter )
4732  /* compact these arrays */
4733  while ( i < ESI->overflow.event_counter - 1 ) {
4734  ESI->overflow.deadline[i] = ESI->overflow.deadline[i + 1];
4735  ESI->overflow.threshold[i] = ESI->overflow.threshold[i + 1];
4736  ESI->overflow.EventIndex[i] = ESI->overflow.EventIndex[i + 1];
4737  ESI->overflow.EventCode[i] = ESI->overflow.EventCode[i + 1];
4738  i++;
4739  }
4740  ESI->overflow.deadline[i] = 0;
4741  ESI->overflow.threshold[i] = 0;
4742  ESI->overflow.EventIndex[i] = 0;
4743  ESI->overflow.EventCode[i] = 0;
4744  ESI->overflow.event_counter--;
4745  } else {
4746  if ( ESI->overflow.event_counter > 0 ) {
4747  if ( ( flags & PAPI_OVERFLOW_FORCE_SW ) &&
4750  if ( !( flags & PAPI_OVERFLOW_FORCE_SW ) &&
4751  ( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) )
4753  }
4754  for ( i = 0; i < ESI->overflow.event_counter; i++ ) {
4755  if ( ESI->overflow.EventCode[i] == EventCode )
4756  break;
4757  }
4758  /* A new entry */
4759  if ( i == ESI->overflow.event_counter ) {
4760  ESI->overflow.EventCode[i] = EventCode;
4761  ESI->overflow.event_counter++;
4762  }
4763  /* New or existing entry */
4764  ESI->overflow.deadline[i] = threshold;
4765  ESI->overflow.threshold[i] = threshold;
4766  ESI->overflow.EventIndex[i] = index;
4767  ESI->overflow.flags = flags;
4768 
4769  }
4770 
4771  /* If overflowing is already active, we should check to
4772  make sure that we don't specify a different handler
4773  or different flags here. You can't mix them. */
4774 
4775  ESI->overflow.handler = handler;
4776 
4777  /* Set up the option structure for the low level.
4778  If we have hardware interrupts and we are not using
4779  forced software emulated interrupts */
4780 
4781  if ( _papi_hwd[cidx]->cmp_info.hardware_intr &&
4782  !( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) ) {
4783  retval = _papi_hwd[cidx]->set_overflow( ESI, index, threshold );
4784  if ( retval == PAPI_OK )
4786  else {
4787  papi_return( retval ); /* We should undo stuff here */
4788  }
4789  } else {
4790  /* Make sure hardware overflow is not set */
4791  ESI->overflow.flags &= ~( PAPI_OVERFLOW_HARDWARE );
4792  }
4793 
4794  APIDBG( "Overflow using: %s\n",
4795  ( ESI->overflow.
4796  flags & PAPI_OVERFLOW_HARDWARE ? "[Hardware]" : ESI->overflow.
4797  flags & PAPI_OVERFLOW_FORCE_SW ? "[Forced Software]" :
4798  "[Software]" ) );
4799 
4800  /* Toggle the overflow flags and ESI state */
4801 
4802  if ( ESI->overflow.event_counter >= 1 )
4803  ESI->state |= PAPI_OVERFLOWING;
4804  else {
4805  ESI->state ^= PAPI_OVERFLOWING;
4806  ESI->overflow.flags = 0;
4807  ESI->overflow.handler = NULL;
4808  }
4809 
4810  return PAPI_OK;
4811 }
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 4520 of file papi.c.

4521 {
4522  char *foo;
4523 
4524  foo = PAPI_strerror( _papi_hwi_errno );
4525  if ( foo == NULL )
4526  return;
4527 
4528  if ( msg )
4529  if ( *msg )
4530  fprintf( stderr, "%s: ", msg );
4531 
4532  fprintf( stderr, "%s\n", foo );
4533 }
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:4470

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 5303 of file papi.c.

5306 {
5307  EventSetInfo_t *ESI;
5308  int i;
5309  int retval;
5310 
5312  if ( ESI == NULL )
5314 
5315  /* scale factors are checked for validity in PAPI_sprofil */
5316 
5317  if ( threshold > 0 ) {
5318  PAPI_sprofil_t *prof;
5319 
5320  for ( i = 0; i < ESI->profile.event_counter; i++ ) {
5321  if ( ESI->profile.EventCode[i] == EventCode )
5322  break;
5323  }
5324 
5325  if ( i == ESI->profile.event_counter ) {
5326  prof =
5327  ( PAPI_sprofil_t * ) papi_malloc( sizeof ( PAPI_sprofil_t ) );
5328  memset( prof, 0x0, sizeof ( PAPI_sprofil_t ) );
5329  prof->pr_base = buf;
5330  prof->pr_size = bufsiz;
5331  prof->pr_off = offset;
5332  prof->pr_scale = scale;
5333 
5334  retval =
5335  PAPI_sprofil( prof, 1, EventSet, EventCode, threshold, flags );
5336 
5337  if ( retval != PAPI_OK )
5338  papi_free( prof );
5339  } else {
5340  prof = ESI->profile.prof[i];
5341  prof->pr_base = buf;
5342  prof->pr_size = bufsiz;
5343  prof->pr_off = offset;
5344  prof->pr_scale = scale;
5345  retval =
5346  PAPI_sprofil( prof, 1, EventSet, EventCode, threshold, flags );
5347  }
5348  papi_return( retval );
5349  }
5350 
5351  for ( i = 0; i < ESI->profile.event_counter; i++ ) {
5352  if ( ESI->profile.EventCode[i] == EventCode )
5353  break;
5354  }
5355  /* EventCode not found */
5356  if ( i == ESI->profile.event_counter )
5358 
5359  papi_free( ESI->profile.prof[i] );
5360  ESI->profile.prof[i] = NULL;
5361 
5362  papi_return( PAPI_sprofil( NULL, 0, EventSet, EventCode, 0, flags ) );
5363 }
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:4910
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 695 of file papi.c.

696 {
697  if ( IS_PRESET(EventCode) ) {
698  EventCode &= PAPI_PRESET_AND_MASK;
699  if ( EventCode >= PAPI_MAX_PRESET_EVENTS )
701 
702  if ( _papi_hwi_presets[EventCode].count )
704  else
705  return PAPI_ENOEVNT;
706  }
707 
708  if ( IS_NATIVE(EventCode) ) {
710  ( ( unsigned int ) EventCode ) );
711  }
712 
713  if ( IS_USER_DEFINED(EventCode) ) {
714  EventCode &= PAPI_UE_AND_MASK;
715  if ( EventCode < 0 || EventCode > (int)_papi_user_events_count)
716  return ( PAPI_EINVAL );
717 
718  papi_return( PAPI_OK );
719  }
720 
722 }
#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 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 763 of file papi.c.

764 {
765  int ret, code;
766 
767  ret = PAPI_event_name_to_code( EventName, &code );
768  if ( ret == PAPI_OK ) ret = PAPI_query_event( code );
769  papi_return( ret);
770 }
#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:1003
int PAPI_query_event(int EventCode)
Definition: papi.c:695

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 2469 of file papi.c.

2470 {
2471  EventSetInfo_t *ESI;
2472  hwd_context_t *context;
2473  int cidx, retval = PAPI_OK;
2474 
2476  if ( ESI == NULL )
2478 
2479  cidx = valid_ESI_component( ESI );
2480  if ( cidx < 0 )
2481  papi_return( cidx );
2482 
2483  if ( values == NULL )
2485 
2486  if ( ESI->state & PAPI_RUNNING ) {
2487  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2488  retval = MPX_read( ESI->multiplex.mpx_evset, values, 0 );
2489  } else {
2490  /* get the context we should use for this event set */
2491  context = _papi_hwi_get_context( ESI, NULL );
2492  retval = _papi_hwi_read( context, ESI, values );
2493  }
2494  if ( retval != PAPI_OK )
2495  papi_return( retval );
2496  } else {
2497  memcpy( values, ESI->sw_stop,
2498  ( size_t ) ESI->NumberOfEvents * sizeof ( long long ) );
2499  }
2500 
2501 #if defined(DEBUG)
2502  if ( ISLEVEL( DEBUG_API ) ) {
2503  int i;
2504  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2505  APIDBG( "PAPI_read values[%d]:\t%lld\n", i, values[i] );
2506  }
2507  }
2508 #endif
2509 
2510  APIDBG( "PAPI_read returns %d\n", retval );
2511  return ( PAPI_OK );
2512 }
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 2557 of file papi.c.

2558 {
2559  EventSetInfo_t *ESI;
2560  hwd_context_t *context;
2561  int cidx, retval = PAPI_OK;
2562 
2564  if ( ESI == NULL )
2566 
2567  cidx = valid_ESI_component( ESI );
2568  if ( cidx < 0 )
2569  papi_return( cidx );
2570 
2571  if ( values == NULL )
2573 
2574  if ( ESI->state & PAPI_RUNNING ) {
2575  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2576  retval = MPX_read( ESI->multiplex.mpx_evset, values, 0 );
2577  } else {
2578  /* get the context we should use for this event set */
2579  context = _papi_hwi_get_context( ESI, NULL );
2580  retval = _papi_hwi_read( context, ESI, values );
2581  }
2582  if ( retval != PAPI_OK )
2583  papi_return( retval );
2584  } else {
2585  memcpy( values, ESI->sw_stop,
2586  ( size_t ) ESI->NumberOfEvents * sizeof ( long long ) );
2587  }
2588 
2589  *cycles = _papi_os_vector.get_real_cycles( );
2590 
2591 #if defined(DEBUG)
2592  if ( ISLEVEL( DEBUG_API ) ) {
2593  int i;
2594  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2595  APIDBG( "PAPI_read values[%d]:\t%lld\n", i, values[i] );
2596  }
2597  }
2598 #endif
2599 
2600  APIDBG( "PAPI_read_ts returns %d\n", retval );
2601  return PAPI_OK;
2602 }
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:

Here is the caller graph for this function:

int PAPI_remove_event ( int  EventSet,
int  EventCode 
)

remove a hardware event from a PAPI event set

Definition at line 1692 of file papi.c.

1693 {
1694  EventSetInfo_t *ESI;
1695  int i,retval;
1696 
1697  /* check for pre-existing ESI */
1698 
1700  if ( ESI == NULL )
1702 
1703  /* Check argument for validity */
1704 
1705  if ( ( !IS_PRESET(EventCode) ) &&
1706  ( !IS_NATIVE(EventCode) ) &&
1707  ( !IS_USER_DEFINED(EventCode) ))
1709 
1710  /* Of course, it must be stopped in order to modify it. */
1711 
1712  if ( !( ESI->