PAPI  5.4.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 2689 of file papi.c.

2690 {
2691  APIDBG("Entry: EventSet: %d, values: %p\n", EventSet, values);
2692  EventSetInfo_t *ESI;
2693  hwd_context_t *context;
2694  int i, cidx, retval;
2695  long long a, b, c;
2696 
2698  if ( ESI == NULL )
2700 
2701  cidx = valid_ESI_component( ESI );
2702  if ( cidx < 0 )
2703  papi_return( cidx );
2704 
2705  if ( values == NULL )
2707 
2708  if ( ESI->state & PAPI_RUNNING ) {
2709  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2710  retval = MPX_read( ESI->multiplex.mpx_evset, ESI->sw_stop, 0 );
2711  } else {
2712  /* get the context we should use for this event set */
2713  context = _papi_hwi_get_context( ESI, NULL );
2714  retval = _papi_hwi_read( context, ESI, ESI->sw_stop );
2715  }
2716  if ( retval != PAPI_OK )
2717  papi_return( retval );
2718  }
2719 
2720  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2721  a = ESI->sw_stop[i];
2722  b = values[i];
2723  c = a + b;
2724  values[i] = c;
2725  }
2726 
2728 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
int PAPI_reset(int EventSet)
Definition: papi.c:2403
#define papi_return(a)
Definition: papi.c:47
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
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
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define PAPI_ENOEVST
Definition: papi.h:262
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:91
EventSetMultiplexInfo_t multiplex
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
long long * sw_stop
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
#define PAPI_RUNNING
Definition: papi.h:373
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 1622 of file papi.c.

1623 {
1624  APIDBG("Entry: EventSet: %d, EventCode: %#x\n", EventSet, EventCode);
1625  EventSetInfo_t *ESI;
1626 
1627  /* Is the EventSet already in existence? */
1628 
1630  if ( ESI == NULL )
1632 
1633  /* Check argument for validity */
1634 
1635  if ( ( ( EventCode & PAPI_PRESET_MASK ) == 0 ) &&
1636  ( EventCode & PAPI_NATIVE_MASK ) == 0 )
1638 
1639  /* Of course, it must be stopped in order to modify it. */
1640 
1641  if ( ESI->state & PAPI_RUNNING )
1643 
1644  /* Now do the magic. */
1645  int retval = _papi_hwi_add_event( ESI, EventCode );
1646  papi_return( retval );
1647 }
#define PAPI_NATIVE_MASK
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
#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: papi.h:262
int _papi_hwi_add_event(EventSetInfo_t *ESI, int EventCode)
#define PAPI_EISRUN
Definition: papi.h:261
#define PAPI_RUNNING
Definition: papi.h:373
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_events ( int  EventSet,
int Events,
int  number 
)

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

Definition at line 5769 of file papi.c.

5770 {
5771  APIDBG( "Entry: EventSet: %d, Events: %p, number: %d\n", EventSet, Events, number);
5772  int i, retval;
5773 
5774  if ( ( Events == NULL ) || ( number <= 0 ) )
5776 
5777  for ( i = 0; i < number; i++ ) {
5778  retval = PAPI_add_event( EventSet, Events[i] );
5779  if ( retval != PAPI_OK ) {
5780  if ( i == 0 )
5781  papi_return( retval );
5782  else
5783  return ( i );
5784  }
5785  }
5786  return ( PAPI_OK );
5787 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1622
static int Events[NUM_EVENTS]
Definition: init_fini.c:8
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
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
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 1835 of file papi.c.

1836 {
1837  APIDBG("Entry: EventSet: %d, EventName: %s\n", EventSet, EventName);
1838  int ret, code;
1839 
1840  ret = PAPI_event_name_to_code( EventName, &code );
1841  if ( ret != PAPI_OK ) {
1842  APIDBG("EXIT: return: %d\n", ret);
1843  return ret; // do not use papi_return here because if there was an error PAPI_event_name_to_code already reported it
1844  }
1845 
1846  ret = PAPI_add_event( EventSet, code );
1847  APIDBG("EXIT: return: %d\n", ret);
1848  return ret; // do not use papi_return here because if there was an error PAPI_add_event already reported it
1849 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1622
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
#define APIDBG(format, args...)
Definition: papi_debug.h:64
long long ret
Definition: iozone.c:1346
int PAPI_event_name_to_code(char *in, int *out)
Definition: papi.c:1010

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

1486 {
1487  EventSetInfo_t *ESI;
1488  int retval;
1489 
1491  if ( ESI == NULL )
1493 
1494 /* validate cidx */
1495  retval = valid_component( cidx );
1496  if ( retval < 0 )
1497  papi_return( retval );
1498 
1499 /* cowardly refuse to reassign eventsets */
1500  if ( ESI->CmpIdx >= 0 )
1501  return PAPI_EINVAL;
1502 
1503  return ( _papi_hwi_assign_eventset( ESI, cidx ) );
1504 }
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_ENOEVST
Definition: papi.h:262
static int cidx
Definition: event_info.c:40
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:83

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

3146 {
3147  APIDBG( "Entry: EventSet: %d, tid: %lu\n", EventSet, tid);
3148  return ( _papi_set_attach( PAPI_ATTACH, EventSet, tid ) );
3149 }
inline_static int _papi_set_attach(int option, int EventSet, unsigned long tid)
Definition: papi.c:3083
int EventSet
Definition: data_range.c:25
#define APIDBG(format, args...)
Definition: papi_debug.h:64
void *long long tid
Definition: iozone.c:18586
#define PAPI_ATTACH
Definition: papi.h:445

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

2835 {
2836  APIDBG("Entry: EventSet: %d\n",EventSet);
2837 
2838  EventSetInfo_t *ESI;
2839  int i, cidx, total, retval;
2840 
2841  /* Is the EventSet already in existence? */
2842 
2844  if ( ESI == NULL )
2846 
2847  /* if the eventset has no index and no events, return OK
2848  otherwise return NOCMP */
2849  cidx = valid_ESI_component( ESI );
2850  if ( cidx < 0 ) {
2851  if ( ESI->NumberOfEvents )
2852  papi_return( cidx );
2853  papi_return( PAPI_OK );
2854  }
2855 
2856  /* Of course, it must be stopped in order to modify it. */
2857 
2858  if ( ESI->state & PAPI_RUNNING )
2860 
2861  /* clear overflow flag and turn off hardware overflow handler */
2862  if ( ESI->state & PAPI_OVERFLOWING ) {
2863  total = ESI->overflow.event_counter;
2864  for ( i = 0; i < total; i++ ) {
2865  retval = PAPI_overflow( EventSet,
2866  ESI->overflow.EventCode[0], 0, 0, NULL );
2867  if ( retval != PAPI_OK )
2868  papi_return( retval );
2869  }
2870  }
2871 
2872  /* clear profile flag and turn off hardware profile handler */
2873  if ( ( ESI->state & PAPI_PROFILING ) &&
2874  _papi_hwd[cidx]->cmp_info.hardware_intr &&
2875  !( ESI->profile.flags & PAPI_PROFIL_FORCE_SW ) ) {
2876  total = ESI->profile.event_counter;
2877  for ( i = 0; i < total; i++ ) {
2878  retval =
2879  PAPI_sprofil( NULL, 0, EventSet, ESI->profile.EventCode[0], 0,
2881  if ( retval != PAPI_OK )
2882  papi_return( retval );
2883  }
2884  }
2885 
2886  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2887  retval = MPX_cleanup( &ESI->multiplex.mpx_evset );
2888  if ( retval != PAPI_OK )
2889  papi_return( retval );
2890  }
2891 
2892  retval = _papi_hwd[cidx]->cleanup_eventset( ESI->ctl_state );
2893  if ( retval != PAPI_OK )
2894  papi_return( retval );
2895 
2896  /* Now do the magic */
2898 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_OVERFLOWING
Definition: papi.h:376
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
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
int PAPI_overflow(int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler)
Definition: papi.c:4714
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int PAPI_sprofil(PAPI_sprofil_t *prof, int profcnt, int EventSet, int EventCode, int threshold, int flags)
Definition: papi.c:4970
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
papi_vector_t * _papi_hwd[]
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define PAPI_ENOEVST
Definition: papi.h:262
static int cidx
Definition: event_info.c:40
int MPX_cleanup(MPX_EventSet **mpx_events)
#define PAPI_EISRUN
Definition: papi.h:261
inline_static int valid_ESI_component(EventSetInfo_t *ESI)
Definition: papi.c:91
unsigned int hardware_intr
Definition: papi.h:649
EventSetMultiplexInfo_t multiplex
int(* cleanup_eventset)(hwd_control_state_t *)
Definition: papi_vector.h:33
#define PAPI_PROFIL_POSIX
Definition: papi.h:394
#define PAPI_PROFILING
Definition: papi.h:377
static int total
Definition: rapl_overflow.c:5
#define PAPI_RUNNING
Definition: papi.h:373
#define PAPI_PROFIL_FORCE_SW
Definition: papi.h:401
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 1424 of file papi.c.

1425 {
1426  APIDBG("Entry: EventSet: %p\n", EventSet);
1427  ThreadInfo_t *master;
1428  int retval;
1429 
1430  if ( init_level == PAPI_NOT_INITED )
1432  retval = _papi_hwi_lookup_or_create_thread( &master, 0 );
1433  if ( retval )
1434  papi_return( retval );
1435 
1437 }
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
#define PAPI_NOT_INITED
Definition: papi.h:278
#define APIDBG(format, args...)
Definition: papi_debug.h:64
inline_static int _papi_hwi_lookup_or_create_thread(ThreadInfo_t **here, int tid)
Definition: threads.h:145
#define PAPI_ENOINIT
Definition: papi.h:267
int init_level
Definition: papi_internal.c:54
ssize_t retval
Definition: libasync.c:338
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 1971 of file papi.c.

1972 {
1973  APIDBG("Entry: EventSet: %p, *EventSet: %d\n", EventSet, *EventSet);
1974 
1975  EventSetInfo_t *ESI;
1976 
1977  /* check for pre-existing ESI */
1978 
1979  if ( EventSet == NULL )
1981 
1983  if ( ESI == NULL )
1985 
1986  if ( !( ESI->state & PAPI_STOPPED ) )
1988 
1989  if ( ESI->NumberOfEvents )
1991 
1993  *EventSet = PAPI_NULL;
1994 
1995  return PAPI_OK;
1996 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_NULL
Definition: papi.h:290
int EventSet
Definition: data_range.c:25
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 APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_ENOEVST
Definition: papi.h:262
#define PAPI_EISRUN
Definition: papi.h:261
#define PAPI_STOPPED
Definition: papi.h:372

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

3203 {
3204  APIDBG( "Entry: EventSet: %d\n", EventSet);
3205  return ( _papi_set_attach( PAPI_DETACH, EventSet, 0 ) );
3206 }
inline_static int _papi_set_attach(int option, int EventSet, unsigned long tid)
Definition: papi.c:3083
int EventSet
Definition: data_range.c:25
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_DETACH
Definition: papi.h:427

Here is the call graph for this function:

Disables a component before init

Definition at line 6592 of file papi.c.

6593 {
6594  APIDBG( "Entry: cidx: %d\n", cidx);
6595 
6596  const PAPI_component_info_t *cinfo;
6597 
6598  /* Can only run before PAPI_library_init() is called */
6599  if (init_level != PAPI_NOT_INITED) {
6600  return PAPI_ENOINIT;
6601  }
6602 
6603  cinfo=PAPI_get_component_info(cidx);
6604  if (cinfo==NULL) return PAPI_ENOCMP;
6605 
6606  ((PAPI_component_info_t *)cinfo)->disabled=1;
6607  strcpy(((PAPI_component_info_t *)cinfo)->disabled_reason,
6608  "Disabled by PAPI_disable_component()");
6609 
6610  return PAPI_OK;
6611 
6612 }
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:807
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_NOT_INITED
Definition: papi.h:278
#define APIDBG(format, args...)
Definition: papi_debug.h:64
static int cidx
Definition: event_info.c:40
strcpy(filename, default_filename)
#define PAPI_ENOCMP
Definition: papi.h:268
#define PAPI_ENOINIT
Definition: papi.h:267
int init_level
Definition: papi_internal.c:54

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

6644 {
6645  APIDBG( "Entry: name: %s\n", name);
6646  int cidx;
6647 
6648  /* I can only be called before init time */
6649  if (init_level!=PAPI_NOT_INITED) {
6650  return PAPI_ENOINIT;
6651  }
6652 
6654  if (cidx>=0) {
6655  return PAPI_disable_component(cidx);
6656  }
6657 
6658  return PAPI_ENOCMP;
6659 }
#define PAPI_NOT_INITED
Definition: papi.h:278
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int PAPI_disable_component(int cidx)
Definition: papi.c:6592
static int cidx
Definition: event_info.c:40
int PAPI_get_component_index(char *name)
Definition: papi.c:6536
#define PAPI_ENOCMP
Definition: papi.h:268
char * name
Definition: iozone.c:23648
#define PAPI_ENOINIT
Definition: papi.h:267
int init_level
Definition: papi_internal.c:54

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

1325 {
1326  APIDBG( "Entry: EventCode: %#x, modifier: %d, cidx: %d\n", *EventCode, modifier, cidx);
1327  int i = *EventCode;
1328  int retval;
1329  int event_code;
1330  char *evt_name;
1331 
1332  if ( _papi_hwi_invalid_cmp(cidx) || ( (IS_PRESET(i)) && cidx > 0 ) ) {
1333  return PAPI_ENOCMP;
1334  }
1335 
1336  if (_papi_hwd[cidx]->cmp_info.disabled) {
1337  return PAPI_ENOCMP;
1338  }
1339 
1340  if ( IS_PRESET(i) ) {
1341  if ( modifier == PAPI_ENUM_FIRST ) {
1342  *EventCode = ( int ) PAPI_PRESET_MASK;
1343  return PAPI_OK;
1344  }
1345  i &= PAPI_PRESET_AND_MASK;
1346  while ( ++i < PAPI_MAX_PRESET_EVENTS ) {
1347  if ( _papi_hwi_presets[i].symbol == NULL )
1348  return ( PAPI_ENOEVNT ); /* NULL pointer terminates list */
1349  if ( modifier & PAPI_PRESET_ENUM_AVAIL ) {
1350  if ( _papi_hwi_presets[i].count == 0 )
1351  continue;
1352  }
1353  *EventCode = ( int ) ( i | PAPI_PRESET_MASK );
1354  return PAPI_OK;
1355  }
1356  } else if ( IS_NATIVE(i) ) {
1357  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
1358  _papi_hwi_set_papi_event_code(*EventCode, 0);
1359 
1360  /* Should we check against num native events here? */
1361  event_code=_papi_hwi_eventcode_to_native(*EventCode);
1362  retval = _papi_hwd[cidx]->ntv_enum_events((unsigned int *)&event_code, modifier );
1363 
1364  if (retval!=PAPI_OK) {
1365  APIDBG("VMW: retval=%d\n",retval);
1366  return PAPI_EINVAL;
1367  }
1368 
1369  evt_name = _papi_hwi_get_papi_event_string();
1370  *EventCode = _papi_hwi_native_to_eventcode(cidx, event_code, -1, evt_name);
1372 
1373  APIDBG("EXIT: *EventCode: %#x\n", *EventCode);
1374  return retval;
1375  }
1376 
1378 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define IS_PRESET(EventCode)
Definition: papi.h:227
char * _papi_hwi_get_papi_event_string()
#define papi_return(a)
Definition: papi.c:47
#define PAPI_MAX_PRESET_EVENTS
void _papi_hwi_free_papi_event_string()
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
papi_vector_t * _papi_hwd[]
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
int _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char *event_name)
#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 PAPI_ENOCMP
Definition: papi.h:268
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int(* ntv_enum_events)(unsigned int *, int)
Definition: papi_vector.h:43
int
Definition: iozone.c:18528
#define PAPI_PRESET_AND_MASK
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 1150 of file papi.c.

1151 {
1152  APIDBG( "Entry: EventCode: %#x, modifier: %d\n", *EventCode, modifier);
1153  int i = *EventCode;
1154  int retval;
1155  int cidx;
1156  int event_code;
1157  char *evt_name;
1158 
1159  cidx = _papi_hwi_component_index( *EventCode );
1160  if (cidx < 0) return PAPI_ENOCMP;
1161 
1162  /* Do we handle presets in componets other than CPU? */
1163  /* if (( IS_PRESET(i) ) && cidx > 0 )) return PAPI_ENOCMP; */
1164 
1165  if ( IS_PRESET(i) ) {
1166  if ( modifier == PAPI_ENUM_FIRST ) {
1167  *EventCode = ( int ) PAPI_PRESET_MASK;
1168  return ( PAPI_OK );
1169  }
1170  i &= PAPI_PRESET_AND_MASK;
1171  while ( ++i < PAPI_MAX_PRESET_EVENTS ) {
1172  if ( _papi_hwi_presets[i].symbol == NULL )
1173  return ( PAPI_ENOEVNT ); /* NULL pointer terminates list */
1174  if ( modifier & PAPI_PRESET_ENUM_AVAIL ) {
1175  if ( _papi_hwi_presets[i].count == 0 )
1176  continue;
1177  }
1178  *EventCode = ( int ) ( i | PAPI_PRESET_MASK );
1179  return ( PAPI_OK );
1180  }
1181  } else if ( IS_NATIVE(i) ) {
1182  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
1183  _papi_hwi_set_papi_event_code(*EventCode, 0);
1184 
1185  /* Should check against num native events here */
1186 
1187  event_code=_papi_hwi_eventcode_to_native((int)*EventCode);
1188  retval = _papi_hwd[cidx]->ntv_enum_events((unsigned int *)&event_code, modifier );
1189 
1190  if (retval!=PAPI_OK) {
1191  APIDBG("VMW: retval=%d\n",retval);
1192  return PAPI_EINVAL;
1193  }
1194 
1195  evt_name = _papi_hwi_get_papi_event_string();
1196  *EventCode = _papi_hwi_native_to_eventcode(cidx, event_code, -1, evt_name);
1198 
1199  APIDBG("EXIT: *EventCode: %#x\n", *EventCode);
1200  return retval;
1201  } else if ( IS_USER_DEFINED(i) ) {
1202  if ( modifier == PAPI_ENUM_FIRST ) {
1203  *EventCode = (int) 0x0;
1204  return ( PAPI_OK );
1205  }
1206 
1207  i &= PAPI_UE_AND_MASK;
1208  ++i;
1209 
1210  if ( (int)_papi_user_events_count <= i )
1211  *EventCode = i;
1212  return ( PAPI_OK );
1213  }
1214 
1216 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define IS_PRESET(EventCode)
Definition: papi.h:227
char * _papi_hwi_get_papi_event_string()
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define papi_return(a)
Definition: papi.c:47
#define PAPI_MAX_PRESET_EVENTS
void _papi_hwi_free_papi_event_string()
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
papi_vector_t * _papi_hwd[]
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
int _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char *event_name)
#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 PAPI_ENOCMP
Definition: papi.h:268
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int(* ntv_enum_events)(unsigned int *, int)
Definition: papi_vector.h:43
int
Definition: iozone.c:18528
int _papi_hwi_component_index(int event_code)
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
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 926 of file papi.c.

927 {
928  APIDBG( "Entry: EventCode: %#x, out: %p\n", EventCode, out);
929  if ( out == NULL )
931 
932  if ( IS_PRESET(EventCode) ) {
933  EventCode &= PAPI_PRESET_AND_MASK;
934  if ( ( EventCode >= PAPI_MAX_PRESET_EVENTS )
935  || ( _papi_hwi_presets[EventCode].symbol == NULL ) )
937 
938  strncpy( out, _papi_hwi_presets[EventCode].symbol,
940  papi_return( PAPI_OK );
941  }
942 
943  if ( IS_NATIVE(EventCode) ) {
945  ( ( unsigned int ) EventCode, out, PAPI_MAX_STR_LEN ) );
946  }
947 
948  if ( IS_USER_DEFINED(EventCode) ) {
949  EventCode &= PAPI_UE_AND_MASK;
950 
951  if ( EventCode < 0 || EventCode > (int)_papi_user_events_count )
953 
954  strncpy( out, _papi_user_events[EventCode].symbol,
956  papi_return( PAPI_OK );
957  }
958 
960 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#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_MAX_PRESET_EVENTS
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 PAPI_ENOTPRESET
Definition: papi.h:263
#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]
goto out
Definition: pscanf.h:20
#define PAPI_MIN_STR_LEN
Definition: papi.h:462
#define PAPI_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
#define PAPI_MAX_STR_LEN
Definition: papi.h:463
user_defined_event_t * _papi_user_events
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 1010 of file papi.c.

1011 {
1012  APIDBG("Entry: in: %p, name: %s, out: %p\n", in, in, out);
1013  int i;
1014 
1015  if ( ( in == NULL ) || ( out == NULL ) )
1017 
1018  if ( init_level == PAPI_NOT_INITED )
1020 
1021  /* All presets start with "PAPI_" so no need to */
1022  /* do an exhaustive search if that's not there */
1023  if (strncmp(in, "PAPI_", 5) == 0) {
1024  for(i = 0; i < PAPI_MAX_PRESET_EVENTS; i++ ) {
1025  if ( ( _papi_hwi_presets[i].symbol )
1026  && ( strcasecmp( _papi_hwi_presets[i].symbol, in ) == 0) ) {
1027  *out = ( int ) ( i | PAPI_PRESET_MASK );
1028  papi_return( PAPI_OK );
1029  }
1030  }
1031  }
1032 
1033  for ( i=0; i < (int)_papi_user_events_count; i++ ) {
1034  if ( strcasecmp( _papi_user_events[i].symbol, in ) == 0 ) {
1035  *out = (int) ( i | PAPI_UE_MASK );
1036  papi_return( PAPI_OK );
1037  }
1038  }
1039 
1041 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_PRESET_MASK
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_NOT_INITED
Definition: papi.h:278
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]
goto out
Definition: pscanf.h:20
int
Definition: iozone.c:18528
#define PAPI_ENOINIT
Definition: papi.h:267
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

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

4275 {
4276  APIDBG( "Entry: option: %d, ptr: %p, cidx: %d\n", option, ptr, cidx);
4277 
4278  if (_papi_hwi_invalid_cmp(cidx)) {
4279  return PAPI_ECMP;
4280  }
4281 
4282  switch ( option ) {
4283  /* For now, MAX_HWCTRS and MAX CTRS are identical.
4284  At some future point, they may map onto different values.
4285  */
4286  case PAPI_MAX_HWCTRS:
4287  return ( _papi_hwd[cidx]->cmp_info.num_cntrs );
4288  case PAPI_MAX_MPX_CTRS:
4289  return ( _papi_hwd[cidx]->cmp_info.num_mpx_cntrs );
4290  case PAPI_DEFDOM:
4291  return ( _papi_hwd[cidx]->cmp_info.default_domain );
4292  case PAPI_DEFGRN:
4293  return ( _papi_hwd[cidx]->cmp_info.default_granularity );
4294  case PAPI_SHLIBINFO:
4295  {
4296  int retval;
4297  if ( ptr == NULL )
4301  papi_return( retval );
4302  }
4303  case PAPI_COMPONENTINFO:
4304  if ( ptr == NULL )
4306  ptr->cmp_info = &( _papi_hwd[cidx]->cmp_info );
4307  return PAPI_OK;
4308  default:
4310  }
4311  return PAPI_OK;
4312 }
#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_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
PAPI_shlib_info_t shlib_info
#define APIDBG(format, args...)
Definition: papi_debug.h:64
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
static int cidx
Definition: event_info.c:40
#define PAPI_DEFGRN
Definition: papi.h:432
#define PAPI_ECMP
Definition: papi.h:254
#define PAPI_MAX_MPX_CTRS
Definition: papi.h:437
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
#define PAPI_COMPONENTINFO
Definition: papi.h:448
#define PAPI_MAX_HWCTRS
Definition: papi.h:441
#define PAPI_DEFDOM
Definition: papi.h:430
int _papi_hwi_invalid_cmp(int cidx)
PAPI_shlib_info_t * shlib_info
Definition: papi.h:859
ssize_t retval
Definition: libasync.c:338
PAPI_component_info_t * cmp_info
Definition: papi.h:861
#define PAPI_SHLIBINFO
Definition: papi.h:446

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

6537 {
6538  APIDBG( "Entry: name: %s\n", name);
6539  int cidx;
6540 
6541  const PAPI_component_info_t *cinfo;
6542 
6543  for(cidx=0;cidx<papi_num_components;cidx++) {
6544 
6545  cinfo=PAPI_get_component_info(cidx);
6546  if (cinfo==NULL) return PAPI_ENOCMP;
6547 
6548  if (!strcmp(name,cinfo->name)) {
6549  return cidx;
6550  }
6551  }
6552 
6553  return PAPI_ENOCMP;
6554 }
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:626
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:807
#define APIDBG(format, args...)
Definition: papi_debug.h:64
static int cidx
Definition: event_info.c:40
#define PAPI_ENOCMP
Definition: papi.h:268
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 807 of file papi.c.

808 {
809  APIDBG( "Entry: Component Index %d\n", cidx);
810  if ( _papi_hwi_invalid_cmp( cidx ) )
811  return ( NULL );
812  else
813  return ( &( _papi_hwd[cidx]->cmp_info ) );
814 }
papi_vector_t * _papi_hwd[]
#define APIDBG(format, args...)
Definition: papi_debug.h:64
static int cidx
Definition: event_info.c:40
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 5989 of file papi.c.

5990 {
5991  if ( dest == NULL )
5992  return PAPI_EINVAL;
5993 
5994  memset( ( void * ) dest, 0x0, sizeof ( PAPI_dmem_info_t ) );
5995  return ( _papi_os_vector.get_dmem_info( dest ) );
5996 }
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:868
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 6509 of file papi.c.

6510 {
6511  APIDBG( "Entry: EventCode: %#x\n", EventCode);
6512  return _papi_hwi_component_index( EventCode);
6513 }
#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 846 of file papi.c.

847 {
848  APIDBG( "Entry: EventCode: 0x%x, info: %p\n", EventCode, info);
849  int i;
850 
851  if ( info == NULL )
853 
854  if ( IS_PRESET(EventCode) ) {
855  i = EventCode & PAPI_PRESET_AND_MASK;
856  if ( i >= PAPI_MAX_PRESET_EVENTS )
858  papi_return( _papi_hwi_get_preset_event_info( EventCode, info ) );
859  }
860 
861  if ( IS_NATIVE(EventCode) ) {
863  ( ( unsigned int ) EventCode, info ) );
864  }
865 
866  if ( IS_USER_DEFINED(EventCode) ) {
867  papi_return( PAPI_OK );
868  }
870 }
#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_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_ENOTPRESET
Definition: papi.h:263
#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_PRESET_AND_MASK

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

1529 {
1530  EventSetInfo_t *ESI;
1531  int retval;
1532 
1533 /* validate eventset */
1535  if ( ESI == NULL )
1537 
1538 /* check if a component has been assigned */
1539  if ( ESI->CmpIdx < 0 )
1541 
1542 /* validate CmpIdx */
1543  retval = valid_component( ESI->CmpIdx );
1544  if ( retval < 0 )
1545  papi_return( retval );
1546 
1547 /* return the index */
1548  return ( ESI->CmpIdx );
1549 }
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define PAPI_ENOEVST
Definition: papi.h:262
#define PAPI_ENOCMP
Definition: papi.h:268
ssize_t retval
Definition: libasync.c:338
inline_static int valid_component(int cidx)
Definition: papi.c:83

Here is the call graph for this function:

get the executable's address space information

Definition at line 6040 of file papi.c.

6041 {
6043  int retval;
6044 
6045  memset( &ptr, 0, sizeof ( ptr ) );
6046  retval = PAPI_get_opt( PAPI_EXEINFO, &ptr );
6047  if ( retval == PAPI_OK )
6048  return ( ptr.exe_info );
6049  else
6050  return ( NULL );
6051 }
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:845
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4082
#define PAPI_EXEINFO
Definition: papi.h:443
PAPI_exe_info_t * exe_info
Definition: papi.h:860
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 6111 of file papi.c.

6112 {
6114  int retval;
6115 
6116  memset( &ptr, 0, sizeof ( ptr ) );
6117  retval = PAPI_get_opt( PAPI_HWINFO, &ptr );
6118  if ( retval == PAPI_OK )
6119  return ( ptr.hw_info );
6120  else
6121  return ( NULL );
6122 }
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:845
PAPI_hw_info_t * hw_info
Definition: papi.h:858
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4082
#define PAPI_HWINFO
Definition: papi.h:442
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 3967 of file papi.c.

3968 {
3969  APIDBG( "Entry: EventSet: %d\n", EventSet);
3970  PAPI_option_t popt;
3971  int retval;
3972 
3973  popt.multiplex.eventset = EventSet;
3974  retval = PAPI_get_opt( PAPI_MULTIPLEX, &popt );
3975  if ( retval < 0 )
3976  retval = 0;
3977  return retval;
3978 }
int EventSet
Definition: data_range.c:25
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:845
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4082
PAPI_multiplex_option_t multiplex
Definition: papi.h:856
#define PAPI_MULTIPLEX
Definition: papi.h:429
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_get_opt ( int  option,
PAPI_option_t ptr 
)

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

Definition at line 4082 of file papi.c.

4083 {
4084  APIDBG( "Entry: option: %d, ptr: %p\n", option, ptr);
4085  EventSetInfo_t *ESI;
4086 
4087  if ( ( option != PAPI_DEBUG ) && ( init_level == PAPI_NOT_INITED ) )
4089 
4090  switch ( option ) {
4091  case PAPI_DETACH:
4092  {
4093  if ( ptr == NULL )
4096  if ( ESI == NULL )
4098  ptr->attach.tid = ESI->attach.tid;
4099  return ( ( ESI->state & PAPI_ATTACHED ) == 0 );
4100  }
4101  case PAPI_ATTACH:
4102  {
4103  if ( ptr == NULL )
4106  if ( ESI == NULL )
4108  ptr->attach.tid = ESI->attach.tid;
4109  return ( ( ESI->state & PAPI_ATTACHED ) != 0 );
4110  }
4111  case PAPI_CPU_ATTACH:
4112  {
4113  if ( ptr == NULL )
4116  if ( ESI == NULL )
4118  ptr->cpu.cpu_num = ESI->CpuInfo->cpu_num;
4119  return ( ( ESI->state & PAPI_CPU_ATTACHED ) != 0 );
4120  }
4121  case PAPI_DEF_MPX_NS:
4122  {
4123  /* xxxx for now, assume we only check against cpu component */
4124  if ( ptr == NULL )
4127  return ( PAPI_OK );
4128  }
4129  case PAPI_DEF_ITIMER_NS:
4130  {
4131  /* xxxx for now, assume we only check against cpu component */
4132  if ( ptr == NULL )
4135  return ( PAPI_OK );
4136  }
4137  case PAPI_DEF_ITIMER:
4138  {
4139  /* xxxx for now, assume we only check against cpu component */
4140  if ( ptr == NULL )
4145  ptr->itimer.flags = 0;
4146  return ( PAPI_OK );
4147  }
4148  case PAPI_MULTIPLEX:
4149  {
4150  if ( ptr == NULL )
4153  if ( ESI == NULL )
4155  ptr->multiplex.ns = ESI->multiplex.ns;
4156  ptr->multiplex.flags = ESI->multiplex.flags;
4157  return ( ESI->state & PAPI_MULTIPLEXING ) != 0;
4158  }
4159  case PAPI_PRELOAD:
4160  if ( ptr == NULL )
4162  memcpy( &ptr->preload, &_papi_hwi_system_info.preload_info,
4164  break;
4165  case PAPI_DEBUG:
4166  if ( ptr == NULL )
4170  break;
4171  case PAPI_CLOCKRATE:
4172  return ( ( int ) _papi_hwi_system_info.hw_info.cpu_max_mhz );
4173  case PAPI_MAX_CPUS:
4174  return ( _papi_hwi_system_info.hw_info.ncpu );
4175  /* For now, MAX_HWCTRS and MAX CTRS are identical.
4176  At some future point, they may map onto different values.
4177  */
4178  case PAPI_INHERIT:
4179  {
4180  if ( ptr == NULL )
4183  if ( ESI == NULL )
4185  ptr->inherit.inherit = ESI->inherit.inherit;
4186  return ( PAPI_OK );
4187  }
4188  case PAPI_GRANUL:
4189  if ( ptr == NULL )
4192  if ( ESI == NULL )
4195  break;
4196  case PAPI_EXEINFO:
4197  if ( ptr == NULL )
4200  break;
4201  case PAPI_HWINFO:
4202  if ( ptr == NULL )
4205  break;
4206 
4207  case PAPI_DOMAIN:
4208  if ( ptr == NULL )
4211  if ( ESI == NULL )
4213  ptr->domain.domain = ESI->domain.domain;
4214  return ( PAPI_OK );
4215  case PAPI_LIB_VERSION:
4216  return ( PAPI_VERSION );
4217 /* The following cases all require a component index
4218  and are handled by PAPI_get_cmp_opt() with cidx == 0*/
4219  case PAPI_MAX_HWCTRS:
4220  case PAPI_MAX_MPX_CTRS:
4221  case PAPI_DEFDOM:
4222  case PAPI_DEFGRN:
4223  case PAPI_SHLIBINFO:
4224  case PAPI_COMPONENTINFO:
4225  return ( PAPI_get_cmp_opt( option, ptr, 0 ) );
4226  default:
4228  }
4229  return ( PAPI_OK );
4230 }
#define PAPI_ATTACHED
Definition: papi.h:379
#define PAPI_CPU_ATTACH
Definition: papi.h:455
#define PAPI_DEF_ITIMER_NS
Definition: papi.h:453
#define papi_return(a)
Definition: papi.c:47
#define PAPI_DEF_MPX_NS
Definition: papi.h:434
PAPI_debug_handler_t _papi_hwi_debug_handler
Definition: papi_internal.c:56
EventSetAttachInfo_t attach
PAPI_granularity_option_t granularity
Definition: papi.h:850
#define PAPI_MULTIPLEXING
Definition: papi.h:378
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_inherit_option_t inherit
Definition: papi.h:849
PAPI_preload_info_t preload_info
PAPI_exe_info_t exe_info
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_NOT_INITED
Definition: papi.h:278
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
PAPI_hw_info_t * hw_info
Definition: papi.h:858
unsigned int cpu_num
Definition: papi.h:821
#define PAPI_INHERIT
Definition: papi.h:456
#define PAPI_PRELOAD
Definition: papi.h:439
#define PAPI_CPU_ATTACHED
Definition: papi.h:380
#define APIDBG(format, args...)
Definition: papi_debug.h:64
EventSetInheritInfo_t inherit
struct _CpuInfo * CpuInfo
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
#define PAPI_ENOEVST
Definition: papi.h:262
#define PAPI_LIB_VERSION
Definition: papi.h:447
int PAPI_get_cmp_opt(int option, PAPI_option_t *ptr, int cidx)
Definition: papi.c:4274
#define PAPI_EXEINFO
Definition: papi.h:443
#define PAPI_GRANUL
Definition: papi.h:433
#define PAPI_MAX_CPUS
Definition: papi.h:444
#define PAPI_DEFGRN
Definition: papi.h:432
#define PAPI_DETACH
Definition: papi.h:427
PAPI_cpu_option_t cpu
Definition: papi.h:855
#define PAPI_ATTACH
Definition: papi.h:445
#define PAPI_MAX_MPX_CTRS
Definition: papi.h:437
int _papi_hwi_error_level
Definition: papi_internal.c:55
PAPI_multiplex_option_t multiplex
Definition: papi.h:856
#define PAPI_MULTIPLEX
Definition: papi.h:429
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_DOMAIN
Definition: papi.h:431
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
#define PAPI_COMPONENTINFO
Definition: papi.h:448
PAPI_debug_handler_t handler
Definition: papi.h:687
unsigned long tid
Definition: papi.h:815
PAPI_attach_option_t attach
Definition: papi.h:854
PAPI_exe_info_t * exe_info
Definition: papi.h:860
#define PAPI_DEF_ITIMER
Definition: papi.h:452
#define PAPI_VERSION
Definition: papi.h:222
#define PAPI_HWINFO
Definition: papi.h:442
#define PAPI_CLOCKRATE
Definition: papi.h:440
PAPI_debug_option_t debug
Definition: papi.h:848
int cpu_max_mhz
Definition: papi.h:793
#define PAPI_MAX_HWCTRS
Definition: papi.h:441
#define PAPI_DEFDOM
Definition: papi.h:430
#define PAPI_ENOINIT
Definition: papi.h:267
PAPI_domain_option_t domain
Definition: papi.h:852
PAPI_preload_info_t preload
Definition: papi.h:847
int init_level
Definition: papi_internal.c:54
PAPI_itimer_option_t itimer
Definition: papi.h:857
#define PAPI_DEBUG
Definition: papi.h:428
int ncpu
Definition: papi.h:778
#define PAPI_SHLIBINFO
Definition: papi.h:446

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

6445 {
6446  APIDBG( "Entry: EventSet: %d, overflow_vector: %lld, array: %p, number: %p\n", EventSet, overflow_vector, array, number);
6447  EventSetInfo_t *ESI;
6448  int set_bit, j, pos;
6449  int count = 0, k;
6450 
6451  if ( overflow_vector == ( long long ) 0 )
6453 
6454  if ( ( array == NULL ) || ( number == NULL ) )
6456 
6457  if ( *number < 1 )
6459 
6461  if ( ESI == NULL )
6463 
6464  /* in case the eventset is empty */
6465  if ( ESI->NumberOfEvents == 0 )
6467 
6468  while ( ( set_bit = ffsll( overflow_vector ) ) ) {
6469  set_bit -= 1;
6470  overflow_vector ^= ( long long ) 1 << set_bit;
6471  for ( j = 0; j < ESI->NumberOfEvents; j++ ) {
6472  for ( k = 0, pos = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT && pos >= 0; k++ ) {
6473  pos = ESI->EventInfoArray[j].pos[k];
6474  if ( ( set_bit == pos ) &&
6475  ( ( ESI->EventInfoArray[j].derived == NOT_DERIVED ) ||
6476  ( ESI->EventInfoArray[j].derived == DERIVED_CMPD ) ) ) {
6477  array[count++] = j;
6478  if ( count == *number )
6479  return PAPI_OK;
6480 
6481  break;
6482  }
6483  }
6484  }
6485  }
6486  *number = count;
6487  return PAPI_OK;
6488 }
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
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 APIDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_ENOEVST
Definition: papi.h:262
#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]
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 6143 of file papi.c.

6144 {
6145  return ( _papi_os_vector.get_real_cycles( ) );
6146 }
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 6163 of file papi.c.

6164 {
6165  return ( ( _papi_os_vector.get_real_nsec( )));
6166 
6167 }
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 6190 of file papi.c.

6191 {
6192  return ( _papi_os_vector.get_real_usec( ) );
6193 }
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 6070 of file papi.c.

6071 {
6073  int retval;
6074 
6075  memset( &ptr, 0, sizeof ( ptr ) );
6076  retval = PAPI_get_opt( PAPI_SHLIBINFO, &ptr );
6077  if ( retval == PAPI_OK )
6078  return ( ptr.shlib_info );
6079  else
6080  return ( NULL );
6081 }
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:845
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4082
PAPI_shlib_info_t * shlib_info
Definition: papi.h:859
ssize_t retval
Definition: libasync.c:338
char * ptr
Definition: iozone.c:23586
#define PAPI_SHLIBINFO
Definition: papi.h:446

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

360 {
362  int doall = 0, retval = PAPI_OK;
363 
364  if ( init_level == PAPI_NOT_INITED )
366  if ( tag & PAPI_TLS_ALL_THREADS ) {
367  tag = tag ^ PAPI_TLS_ALL_THREADS;
368  doall = 1;
369  }
370  if ( ( tag < 0 ) || ( tag > PAPI_TLS_NUM ) )
372 
373  if ( doall )
375  ( tag, ( PAPI_all_thr_spec_t * ) ptr ) );
376 
378  if ( retval == PAPI_OK )
379  *ptr = thread->thread_storage[tag];
380  else
381  papi_return( retval );
382 
383  return ( PAPI_OK );
384 }
#define papi_return(a)
Definition: papi.c:47
#define PAPI_TLS_NUM
Definition: papi.h:324
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_NOT_INITED
Definition: papi.h:278
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
#define PAPI_ENOINIT
Definition: papi.h:267
int init_level
Definition: papi_internal.c:54
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:

return the process cycles since some arbitrary starting point

Definition at line 6226 of file papi.c.

6227 {
6228 
6229  return ( ( long long ) _papi_os_vector.get_virt_cycles( ) );
6230 }
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 6256 of file papi.c.

6257 {
6258 
6259  return ( ( _papi_os_vector.get_virt_nsec()));
6260 
6261 }
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 6298 of file papi.c.

6299 {
6300 
6301  return ( ( long long ) _papi_os_vector.get_virt_usec() );
6302 }
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 6389 of file papi.c.

6390 {
6391  return ( init_level );
6392 }
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 497 of file papi.c.

498 {
499  APIDBG( "Entry: version: %#x\n", version);
500  char *filename;
501  int tmp = 0, tmpel;
502 
503  /* This is a poor attempt at a lock.
504  For 3.1 this should be replaced with a
505  true UNIX semaphore. We cannot use PAPI
506  locks here because they are not initialized yet */
507  static int _in_papi_library_init_cnt = 0;
508 #ifdef DEBUG
509  char *var;
510 #endif
512 
513  if ( version != PAPI_VER_CURRENT )
515 
516  ++_in_papi_library_init_cnt;
517  while ( _in_papi_library_init_cnt > 1 ) {
518  PAPIERROR( "Multiple callers of PAPI_library_init" );
519  sleep( 1 );
520  }
521 
522  /* This checks to see if we have forked or called init more than once.
523  If we have forked, then we continue to init. If we have not forked,
524  we check to see the status of initialization. */
525 
526  APIDBG( "Initializing library: current PID %d, old PID %d\n",
527  getpid( ), _papi_hwi_system_info.pid );
528 
529  if ( _papi_hwi_system_info.pid == getpid( ) ) {
530  /* If the magic environment variable PAPI_ALLOW_STOLEN is set,
531  we call shutdown if PAPI has been initialized. This allows
532  tools that use LD_PRELOAD to run on applications that use PAPI.
533  In this circumstance, PAPI_ALLOW_STOLEN will be set to 'stolen'
534  so the tool can check for this case. */
535 
536  if ( getenv( "PAPI_ALLOW_STOLEN" ) ) {
537  char buf[PAPI_HUGE_STR_LEN];
538  if ( init_level != PAPI_NOT_INITED )
539  PAPI_shutdown( );
540  sprintf( buf, "%s=%s", "PAPI_ALLOW_STOLEN", "stolen" );
541  putenv( buf );
542  }
543 
544  /* If the library has been successfully initialized *OR*
545  the library attempted initialization but failed. */
546 
547  else if ( ( init_level != PAPI_NOT_INITED ) ||
548  ( init_retval != DEADBEEF ) ) {
549  _in_papi_library_init_cnt--;
550  if ( init_retval < PAPI_OK )
552  else
553  return ( init_retval );
554  }
555 
556  APIDBG( "system_info was initialized, but init did not succeed\n" );
557  }
558 #ifdef DEBUG
559  var = ( char * ) getenv( "PAPI_DEBUG" );
560  _papi_hwi_debug = 0;
561 
562  if ( var != NULL ) {
563  if ( strlen( var ) != 0 ) {
564  if ( strstr( var, "SUBSTRATE" ) )
566  if ( strstr( var, "API" ) )
568  if ( strstr( var, "INTERNAL" ) )
570  if ( strstr( var, "THREADS" ) )
572  if ( strstr( var, "MULTIPLEX" ) )
574  if ( strstr( var, "OVERFLOW" ) )
576  if ( strstr( var, "PROFILE" ) )
578  if ( strstr( var, "MEMORY" ) )
580  if ( strstr( var, "LEAK" ) )
582  if ( strstr( var, "ALL" ) )
584  }
585 
586  if ( _papi_hwi_debug == 0 )
588  }
589 #endif
590 
591  /* Be verbose for now */
592 
593  tmpel = _papi_hwi_error_level;
595 
596  /* Initialize internal globals */
598  _in_papi_library_init_cnt--;
599  _papi_hwi_error_level = tmpel;
601  }
602 
603  /* Initialize OS */
604  tmp = _papi_hwi_init_os();
605  if ( tmp ) {
606  init_retval = tmp;
608  _in_papi_library_init_cnt--;
609  _papi_hwi_error_level = tmpel;
611  }
612 
613  /* Initialize component globals */
614 
615  tmp = _papi_hwi_init_global( );
616  if ( tmp ) {
617  init_retval = tmp;
619  _in_papi_library_init_cnt--;
620  _papi_hwi_error_level = tmpel;
622  }
623 
624  /* Initialize thread globals, including the main threads */
625 
627  if ( tmp ) {
628  int i;
629  init_retval = tmp;
631  for ( i = 0; i < papi_num_components; i++ ) {
632  if (!_papi_hwd[i]->cmp_info.disabled) {
634  }
635  }
636  _in_papi_library_init_cnt--;
637  _papi_hwi_error_level = tmpel;
639  }
640 
642  _in_papi_library_init_cnt--;
643  _papi_hwi_error_level = tmpel;
644 
645 #ifdef STATIC_USER_EVENTS
647 #endif
648 
649  if ( (filename = getenv( "PAPI_USER_EVENTS_FILE" )) != NULL ) {
651  }
652 
653  return ( init_retval = PAPI_VER_CURRENT );
654 }
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()
#define PAPI_VERB_ECONT
Definition: papi.h:387
sleep(1)
int _papi_hwi_debug
Definition: papi.c:76
#define papi_return(a)
Definition: papi.c:47
#define PAPI_LOW_LEVEL_INITED
Definition: papi.h:279
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 PAPI_NOT_INITED
Definition: papi.h:278
#define DEBUG_MEMORY
Definition: papi_debug.h:34
papi_vector_t * _papi_hwd[]
#define DEBUG_API
Definition: papi_debug.h:28
#define PAPI_HUGE_STR_LEN
Definition: papi.h:465
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int(* shutdown_component)(void)
Definition: papi_vector.h:54
#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:4400
#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:80
#define DEBUG_OVERFLOW
Definition: papi_debug.h:32
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
int papi_num_components
int _papi_hwi_init_os(void)
Definition: aix.c:1213
int _papi_hwi_init_global(void)
#define DEBUG_THREADS
Definition: papi_debug.h:30
int init_level
Definition: papi_internal.c:54
long long tmp
Definition: iozone.c:12031
#define PAPI_VER_CURRENT
Definition: papi.h:223
int _papi_hwi_init_global_threads(void)
Definition: threads.c:527
#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 5927 of file papi.c.

5928 {
5929  APIDBG( "Entry: EventSet: %d, Events: %p, number: %p\n", EventSet, Events, number);
5930  EventSetInfo_t *ESI;
5931  int i, j;
5932 
5933  if ( *number < 0 )
5935 
5936  if ( ( Events == NULL ) && ( *number > 0 ) )
5938 
5940  if ( !ESI )
5942 
5943  if ( ( Events == NULL ) || ( *number == 0 ) ) {
5944  *number = ESI->NumberOfEvents;
5945  papi_return( PAPI_OK );
5946  }
5947 
5948  for ( i = 0, j = 0; j < ESI->NumberOfEvents; i++ ) {
5949  if ( ( int ) ESI->EventInfoArray[i].event_code != PAPI_NULL ) {
5950  Events[j] = ( int ) ESI->EventInfoArray[i].event_code;
5951  j++;
5952  if ( j == *number )
5953  break;
5954  }
5955  }
5956 
5957  *number = j;
5958 
5959  return ( PAPI_OK );
5960 }
static int Events[NUM_EVENTS]
Definition: init_fini.c:8
#define papi_return(a)
Definition: papi.c:47
#define PAPI_NULL
Definition: papi.h:290
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define PAPI_ENOEVST
Definition: papi.h:262
EventInfo_t * EventInfoArray
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 283 of file papi.c.

284 {
286  int retval;
287 
288  /* If tids == NULL, then just count the threads, don't gather a list. */
289  /* If tids != NULL, then we need the length of the tids array in num. */
290 
291  if ( ( number == NULL ) || ( tids && ( *number <= 0 ) ) )
293 
294  memset( &tmp, 0x0, sizeof ( tmp ) );
295 
296  /* data == NULL, since we don't want the thread specific pointers. */
297  /* tids may be NULL, if the user doesn't want the thread IDs. */
298 
299  tmp.num = *number;
300  tmp.id = tids;
301  tmp.data = NULL;
302 
303  retval = _papi_hwi_gather_all_thrspec_data( 0, &tmp );
304  if ( retval == PAPI_OK )
305  *number = tmp.num;
306 
307  papi_return( retval );
308 }
memset(eventId, 0, size)
void ** data
Definition: papi.h:561
#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:560
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 6327 of file papi.c.

6328 {
6329  if ( ( lck < 0 ) || ( lck >= PAPI_NUM_LOCK ) )
6331 
6332  papi_return( _papi_hwi_lock( lck ) );
6333 }
#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 2926 of file papi.c.

2927 {
2928  APIDBG("Entry:\n");
2929 
2930  int retval;
2931 
2932  retval = mpx_init( _papi_os_info.itimer_ns );
2933  papi_return( retval );
2934 }
#define papi_return(a)
Definition: papi.c:47
#define APIDBG(format, args...)
Definition: papi_debug.h:64
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 3904 of file papi.c.

3905 {
3906  APIDBG( "Entry: cidx: %d\n", cidx);
3907  return ( PAPI_get_cmp_opt( PAPI_MAX_HWCTRS, NULL, cidx ) );
3908 }
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int PAPI_get_cmp_opt(int option, PAPI_option_t *ptr, int cidx)
Definition: papi.c:4274
static int cidx
Definition: event_info.c:40
#define PAPI_MAX_HWCTRS
Definition: papi.h:441

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

4366 {
4367  APIDBG( "Entry: EventSet: %d\n", EventSet);
4368  EventSetInfo_t *ESI;
4369 
4371  if ( !ESI )
4373 
4374 #ifdef DEBUG
4375  /* Not necessary */
4376  if ( ESI->NumberOfEvents == 0 )
4378 #endif
4379 
4380  return ( ESI->NumberOfEvents );
4381 }
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
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: papi.h:262

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

4716 {
4717  APIDBG( "Entry: EventSet: %d, EventCode: %#x, threshold: %d, flags: %#x, handler: %p\n", EventSet, EventCode, threshold, flags, handler);
4718  int retval, cidx, index, i;
4719  EventSetInfo_t *ESI;
4720 
4722  if ( ESI == NULL ) {
4723  OVFDBG("No EventSet\n");
4725  }
4726 
4727  cidx = valid_ESI_component( ESI );
4728  if ( cidx < 0 ) {
4729  OVFDBG("Component Error\n");
4730  papi_return( cidx );
4731  }
4732 
4733  if ( ( ESI->state & PAPI_STOPPED ) != PAPI_STOPPED ) {
4734  OVFDBG("Already running\n");
4736  }
4737 
4738  if ( ESI->state & PAPI_ATTACHED ) {
4739  OVFDBG("Attached\n");
4741  }
4742 
4743  if ( ESI->state & PAPI_CPU_ATTACHED ) {
4744  OVFDBG("CPU attached\n");
4746  }
4747 
4748  if ( ( index = _papi_hwi_lookup_EventCodeIndex( ESI,
4749  ( unsigned int ) EventCode ) ) < 0 ) {
4751  }
4752 
4753  if ( threshold < 0 ) {
4754  OVFDBG("Threshold below zero\n");
4756  }
4757 
4758  /* We do not support derived events in overflow */
4759  /* Unless it's DERIVED_CMPD in which no calculations are done */
4760 
4761  if ( !( flags & PAPI_OVERFLOW_FORCE_SW ) && threshold != 0 &&
4762  ( ESI->EventInfoArray[index].derived ) &&
4763  ( ESI->EventInfoArray[index].derived != DERIVED_CMPD ) ) {
4764  OVFDBG("Derived event in overflow\n");
4766  }
4767 
4768  /* the first time to call PAPI_overflow function */
4769 
4770  if ( !( ESI->state & PAPI_OVERFLOWING ) ) {
4771  if ( handler == NULL ) {
4772  OVFDBG("NULL handler\n");
4774  }
4775  if ( threshold == 0 ) {
4776  OVFDBG("Zero threshold\n");
4778  }
4779  }
4780  if ( threshold > 0 &&
4783 
4784  if ( threshold == 0 ) {
4785  for ( i = 0; i < ESI->overflow.event_counter; i++ ) {
4786  if ( ESI->overflow.EventCode[i] == EventCode )
4787  break;
4788  }
4789  /* EventCode not found */
4790  if ( i == ESI->overflow.event_counter )
4792  /* compact these arrays */
4793  while ( i < ESI->overflow.event_counter - 1 ) {
4794  ESI->overflow.deadline[i] = ESI->overflow.deadline[i + 1];
4795  ESI->overflow.threshold[i] = ESI->overflow.threshold[i + 1];
4796  ESI->overflow.EventIndex[i] = ESI->overflow.EventIndex[i + 1];
4797  ESI->overflow.EventCode[i] = ESI->overflow.EventCode[i + 1];
4798  i++;
4799  }
4800  ESI->overflow.deadline[i] = 0;
4801  ESI->overflow.threshold[i] = 0;
4802  ESI->overflow.EventIndex[i] = 0;
4803  ESI->overflow.EventCode[i] = 0;
4804  ESI->overflow.event_counter--;
4805  } else {
4806  if ( ESI->overflow.event_counter > 0 ) {
4807  if ( ( flags & PAPI_OVERFLOW_FORCE_SW ) &&
4810  if ( !( flags & PAPI_OVERFLOW_FORCE_SW ) &&
4811  ( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) )
4813  }
4814  for ( i = 0; i < ESI->overflow.event_counter; i++ ) {
4815  if ( ESI->overflow.EventCode[i] == EventCode )
4816  break;
4817  }
4818  /* A new entry */
4819  if ( i == ESI->overflow.event_counter ) {
4820  ESI->overflow.EventCode[i] = EventCode;
4821  ESI->overflow.event_counter++;
4822  }
4823  /* New or existing entry */
4824  ESI->overflow.deadline[i] = threshold;
4825  ESI->overflow.threshold[i] = threshold;
4826  ESI->overflow.EventIndex[i] = index;
4827  ESI->overflow.flags = flags;
4828 
4829  }
4830 
4831  /* If overflowing is already active, we should check to
4832  make sure that we don't specify a different handler
4833  or different flags here. You can't mix them. */
4834 
4835  ESI->overflow.handler = handler;
4836 
4837  /* Set up the option structure for the low level.
4838  If we have hardware interrupts and we are not using
4839  forced software emulated interrupts */
4840 
4841  if ( _papi_hwd[cidx]->cmp_info.hardware_intr &&
4842  !( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) ) {
4843  retval = _papi_hwd[cidx]->set_overflow( ESI, index, threshold );
4844  if ( retval == PAPI_OK )
4846  else {
4847  papi_return( retval ); /* We should undo stuff here */
4848  }
4849  } else {
4850  /* Make sure hardware overflow is not set */
4851  ESI->overflow.flags &= ~( PAPI_OVERFLOW_HARDWARE );
4852  }
4853 
4854  APIDBG( "Overflow using: %s\n",
4855  ( ESI->overflow.
4856  flags & PAPI_OVERFLOW_HARDWARE ? "[Hardware]" : ESI->overflow.
4857  flags & PAPI_OVERFLOW_FORCE_SW ? "[Forced Software]" :
4858  "[Software]" ) );
4859 
4860  /* Toggle the overflow flags and ESI state */
4861 
4862  if ( ESI->overflow.event_counter >= 1 )
4863  ESI->state |= PAPI_OVERFLOWING;
4864  else {
4865  ESI->state ^= PAPI_OVERFLOWING;
4866  ESI->overflow.flags = 0;
4867  ESI->overflow.handler = NULL;
4868  }
4869 
4870  return PAPI_OK;
4871 }
#define PAPI_ATTACHED
Definition: papi.h:379
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_OVERFLOWING
Definition: papi.h:376
long long flags
Definition: iozone.c:12330
#define papi_return(a)
Definition: papi.c:47
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
#define DERIVED_CMPD
Definition: papi_internal.h:73
papi_vector_t * _papi_hwd[]
#define PAPI_CPU_ATTACHED
Definition: papi.h:380
#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: papi.h:262
static int cidx
Definition: event_info.c:40
#define OVFDBG(format, args...)
Definition: papi_debug.h:68
int _papi_hwi_lookup_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
#define PAPI_ECNFLCT
Definition: papi.h:259
#define PAPI_EISRUN
Definition: papi.h:261
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:91
EventInfo_t * EventInfoArray
int threshold
#define PAPI_OVERFLOW_FORCE_SW
Definition: papi.h:409
#define PAPI_STOPPED
Definition: papi.h:372
ssize_t retval
Definition: libasync.c:338
PAPI_overflow_handler_t handler
int(* set_overflow)(EventSetInfo_t *, int, int)
Definition: papi_vector.h:40

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

4580 {
4581  char *foo;
4582 
4583  foo = PAPI_strerror( _papi_hwi_errno );
4584  if ( foo == NULL )
4585  return;
4586 
4587  if ( msg )
4588  if ( *msg )
4589  fprintf( stderr, "%s: ", msg );
4590 
4591  fprintf( stderr, "%s\n", foo );
4592 }
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:4529

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

5367 {
5368  APIDBG( "Entry: buf: %p, bufsiz: %d, offset: %p, scale: %u, EventSet: %d, EventCode: %#x, threshold: %d, flags: %#x\n", buf, bufsiz, offset, scale, EventSet, EventCode, threshold, flags);
5369  EventSetInfo_t *ESI;
5370  int i;
5371  int retval;
5372 
5374  if ( ESI == NULL )
5376 
5377  /* scale factors are checked for validity in PAPI_sprofil */
5378 
5379  if ( threshold > 0 ) {
5380  PAPI_sprofil_t *prof;
5381 
5382  for ( i = 0; i < ESI->profile.event_counter; i++ ) {
5383  if ( ESI->profile.EventCode[i] == EventCode )
5384  break;
5385  }
5386 
5387  if ( i == ESI->profile.event_counter ) {
5388  prof =
5389  ( PAPI_sprofil_t * ) papi_malloc( sizeof ( PAPI_sprofil_t ) );
5390  memset( prof, 0x0, sizeof ( PAPI_sprofil_t ) );
5391  prof->pr_base = buf;
5392  prof->pr_size = bufsiz;
5393  prof->pr_off = offset;
5394  prof->pr_scale = scale;
5395 
5396  retval =
5397  PAPI_sprofil( prof, 1, EventSet, EventCode, threshold, flags );
5398 
5399  if ( retval != PAPI_OK )
5400  papi_free( prof );
5401  } else {
5402  prof = ESI->profile.prof[i];
5403  prof->pr_base = buf;
5404  prof->pr_size = bufsiz;
5405  prof->pr_off = offset;
5406  prof->pr_scale = scale;
5407  retval =
5408  PAPI_sprofil( prof, 1, EventSet, EventCode, threshold, flags );
5409  }
5410  papi_return( retval );
5411  }
5412 
5413  for ( i = 0; i < ESI->profile.event_counter; i++ ) {
5414  if ( ESI->profile.EventCode[i] == EventCode )
5415  break;
5416  }
5417  /* EventCode not found */
5418  if ( i == ESI->profile.event_counter )
5420 
5421  papi_free( ESI->profile.prof[i] );
5422  ESI->profile.prof[i] = NULL;
5423 
5424  papi_return( PAPI_sprofil( NULL, 0, EventSet, EventCode, 0, flags ) );
5425 }
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
int EventSet
Definition: data_range.c:25
caddr_t pr_off
Definition: papi.h:581
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:4970
EventSetInfo_t * _papi_hwi_lookup_EventSet(int eventset)
unsigned pr_scale
Definition: papi.h:582
#define APIDBG(format, args...)
Definition: papi_debug.h:64
unsigned pr_size
Definition: papi.h:580
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
#define PAPI_ENOEVST
Definition: papi.h:262
PAPI_sprofil_t ** prof
int threshold
void * pr_base
Definition: papi.h:579
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 698 of file papi.c.

699 {
700  APIDBG( "Entry: EventCode: %#x\n", EventCode);
701  if ( IS_PRESET(EventCode) ) {
702  EventCode &= PAPI_PRESET_AND_MASK;
703  if ( EventCode >= PAPI_MAX_PRESET_EVENTS )
705 
706  if ( _papi_hwi_presets[EventCode].count )
708  else
709  return PAPI_ENOEVNT;
710  }
711 
712  if ( IS_NATIVE(EventCode) ) {
714  ( ( unsigned int ) EventCode ) );
715  }
716 
717  if ( IS_USER_DEFINED(EventCode) ) {
718  EventCode &= PAPI_UE_AND_MASK;
719  if ( EventCode < 0 || EventCode > (int)_papi_user_events_count)
720  return ( PAPI_EINVAL );
721 
722  papi_return( PAPI_OK );
723  }
724 
726 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#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_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_ENOTPRESET
Definition: papi.h:263
#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_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
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 767 of file papi.c.

768 {
769  int ret, code;
770 
771  ret = PAPI_event_name_to_code( EventName, &code );
772  if ( ret == PAPI_OK ) ret = PAPI_query_event( code );
773  papi_return( ret);
774 }
#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:1010
int PAPI_query_event(int EventCode)
Definition: papi.c:698

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

2504 {
2505  APIDBG( "Entry: EventSet: %d, values: %p\n", EventSet, values);
2506  EventSetInfo_t *ESI;
2507  hwd_context_t *context;
2508  int cidx, retval = PAPI_OK;
2509 
2511  if ( ESI == NULL )
2513 
2514  cidx = valid_ESI_component( ESI );
2515  if ( cidx < 0 )
2516  papi_return( cidx );
2517 
2518  if ( values == NULL )
2520 
2521  if ( ESI->state & PAPI_RUNNING ) {
2522  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2523  retval = MPX_read( ESI->multiplex.mpx_evset, values, 0 );
2524  } else {
2525  /* get the context we should use for this event set */
2526  context = _papi_hwi_get_context( ESI, NULL );
2527  retval = _papi_hwi_read( context, ESI, values );
2528  }
2529  if ( retval != PAPI_OK )
2530  papi_return( retval );
2531  } else {
2532  memcpy( values, ESI->sw_stop,
2533  ( size_t ) ESI->NumberOfEvents * sizeof ( long long ) );
2534  }
2535 
2536 #if defined(DEBUG)
2537  if ( ISLEVEL( DEBUG_API ) ) {
2538  int i;
2539  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2540  APIDBG( "PAPI_read values[%d]:\t%lld\n", i, values[i] );
2541  }
2542  }
2543 #endif
2544 
2545  APIDBG( "PAPI_read returns %d\n", retval );
2546  return ( PAPI_OK );
2547 }
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
int EventSet
Definition: data_range.c:25
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 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: papi.h:262
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:91
again struct sockaddr sizeof(struct sockaddr_in))
EventSetMultiplexInfo_t multiplex
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
long long * sw_stop
#define PAPI_RUNNING
Definition: papi.h:373
#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 2592 of file papi.c.

2593 {
2594  APIDBG( "Entry: EventSet: %d, values: %p, cycles: %p\n", EventSet, values, cycles);
2595  EventSetInfo_t *ESI;
2596  hwd_context_t *context;
2597  int cidx, retval = PAPI_OK;
2598 
2600  if ( ESI == NULL )
2602 
2603  cidx = valid_ESI_component( ESI );
2604  if ( cidx < 0 )
2605  papi_return( cidx );
2606 
2607  if ( values == NULL )
2609 
2610  if ( ESI->state & PAPI_RUNNING ) {
2611  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
2612  retval = MPX_read( ESI->multiplex.mpx_evset, values, 0 );
2613  } else {
2614  /* get the context we should use for this event set */
2615  context = _papi_hwi_get_context( ESI, NULL );
2616  retval = _papi_hwi_read( context, ESI, values );
2617  }
2618  if ( retval != PAPI_OK )
2619  papi_return( retval );
2620  } else {
2621  memcpy( values, ESI->sw_stop,
2622  ( size_t ) ESI->NumberOfEvents * sizeof ( long long ) );
2623  }
2624 
2625  *cycles = _papi_os_vector.get_real_cycles( );
2626 
2627 #if defined(DEBUG)
2628  if ( ISLEVEL( DEBUG_API ) ) {
2629  int i;
2630  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
2631  APIDBG( "PAPI_read values[%d]:\t%lld\n", i, values[i] );
2632  }
2633  }
2634 #endif
2635 
2636  APIDBG( "PAPI_read_ts returns %d\n", retval );
2637  return PAPI_OK;
2638 }