PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
papi_internal.h File Reference
Include dependency graph for papi_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  EventSetDomainInfo_t
 
struct  EventSetGranularityInfo_t
 
struct  EventSetOverflowInfo_t
 
struct  EventSetAttachInfo_t
 
struct  EventSetCpuInfo_t
 
struct  EventSetInheritInfo_t
 
struct  EventSetProfileInfo_t
 
struct  EventInfo_t
 
struct  NativeInfo_t
 
struct  PapiInfo
 
struct  MasterEvent
 
struct  Threadlist
 
struct  EventSetInfo_t
 
struct  DynamicArray_t
 
struct  _papi_int_attach_t
 
struct  _papi_int_cpu_t
 
struct  _papi_int_multiplex_t
 
struct  _papi_int_defdomain_t
 
struct  _papi_int_domain_t
 
struct  _papi_int_granularity_t
 
struct  _papi_int_overflow_t
 
struct  _papi_int_profile_t
 
struct  _papi_int_inherit_t
 
struct  _papi_int_addr_range_t
 
union  _papi_int_option_t
 
struct  _papi_hwi_context_t
 
struct  papi_mdi_t
 
struct  PAPI_os_info_t
 

Macros

#define DEADBEEF   0xdedbeef
 
#define PAPI_ERROR_CODE_str   "Error Code"
 
#define PAPI_SHUTDOWN_str   "PAPI_shutdown: PAPI is not initialized"
 
#define PAPI_SHUTDOWN_SYNC_str   "PAPI_shutdown: other threads still have running EventSets"
 
#define PAPI_INT_MPX_SIGNAL   SIGPROF
 
#define PAPI_INT_SIGNAL   SIGPROF
 
#define PAPI_INT_ITIMER   ITIMER_PROF
 
#define PAPI_INT_ITIMER_MS   1
 
#define PAPI_NSIG   128
 
#define PAPI_INT_MPX_DEF_US   10000 /*Default resolution in us. of mpx handler */
 
#define NOT_DERIVED   0x0
 
#define DERIVED_ADD   0x1
 
#define DERIVED_PS   0x2
 
#define DERIVED_ADD_PS   0x4
 
#define DERIVED_CMPD   0x8
 
#define DERIVED_SUB   0x10
 
#define DERIVED_POSTFIX   0x20
 
#define DERIVED_INFIX   0x40
 
#define LOWLEVEL_TLS   PAPI_NUM_TLS+0
 
#define NUM_INNER_TLS   1
 
#define PAPI_MAX_TLS   (NUM_INNER_TLS+PAPI_NUM_TLS)
 
#define INTERNAL_LOCK   PAPI_NUM_LOCK+0 /* papi_internal.c */
 
#define MULTIPLEX_LOCK   PAPI_NUM_LOCK+1 /* multiplex.c */
 
#define THREADS_LOCK   PAPI_NUM_LOCK+2 /* threads.c */
 
#define HIGHLEVEL_LOCK   PAPI_NUM_LOCK+3 /* papi_hl.c */
 
#define MEMORY_LOCK   PAPI_NUM_LOCK+4 /* papi_memory.c */
 
#define COMPONENT_LOCK   PAPI_NUM_LOCK+5 /* per-component */
 
#define GLOBAL_LOCK   PAPI_NUM_LOCK+6 /* papi.c for global variable (static and non) initialization/shutdown */
 
#define CPUS_LOCK   PAPI_NUM_LOCK+7 /* cpus.c */
 
#define NAMELIB_LOCK   PAPI_NUM_LOCK+8 /* papi_pfm4_events.c */
 
#define NEED_CONTEXT   1
 
#define DONT_NEED_CONTEXT   0
 
#define PAPI_EVENTS_IN_DERIVED_EVENT   8
 
#define hwd_context_t   void
 
#define hwd_control_state_t   void
 
#define hwd_reg_alloc_t   void
 
#define hwd_register_t   void
 
#define hwd_siginfo_t   void
 
#define hwd_ucontext_t   void
 
#define inline_static   inline static
 

Typedefs

typedef PAPI_itimer_option_t _papi_int_itimer_t
 

Functions

EventSetInfo_t_papi_hwi_lookup_EventSet (int eventset)
 
void _papi_hwi_set_papi_event_string (const char *event_string)
 
char * _papi_hwi_get_papi_event_string (void)
 
void _papi_hwi_free_papi_event_string ()
 
void _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag)
 
unsigned int _papi_hwi_get_papi_event_code (void)
 
int _papi_hwi_get_ntv_idx (unsigned int papi_evt_code)
 
int _papi_hwi_is_sw_multiplex (EventSetInfo_t *ESI)
 
hwd_context_t_papi_hwi_get_context (EventSetInfo_t *ESI, int *is_dirty)
 
void PAPIERROR (char *format,...)
 
void PAPIWARN (char *format,...)
 
int _papi_hwi_assign_eventset (EventSetInfo_t *ESI, int cidx)
 
void _papi_hwi_free_EventSet (EventSetInfo_t *ESI)
 
int _papi_hwi_create_eventset (int *EventSet, ThreadInfo_t *handle)
 
int _papi_hwi_lookup_EventCodeIndex (const EventSetInfo_t *ESI, unsigned int EventCode)
 
int _papi_hwi_remove_EventSet (EventSetInfo_t *ESI)
 
void _papi_hwi_map_events_to_native (EventSetInfo_t *ESI)
 
int _papi_hwi_add_event (EventSetInfo_t *ESI, int EventCode)
 
int _papi_hwi_remove_event (EventSetInfo_t *ESI, int EventCode)
 
int _papi_hwi_read (hwd_context_t *context, EventSetInfo_t *ESI, long long *values)
 
int _papi_hwi_cleanup_eventset (EventSetInfo_t *ESI)
 
int _papi_hwi_convert_eventset_to_multiplex (_papi_int_multiplex_t *mpx)
 
int _papi_hwi_init_global (void)
 
int _papi_hwi_init_global_internal (void)
 
int _papi_hwi_init_os (void)
 
void _papi_hwi_init_errors (void)
 
PAPI_os_info_t_papi_hwi_get_os_info (void)
 
void _papi_hwi_shutdown_global_internal (void)
 
void _papi_hwi_dummy_handler (int EventSet, void *address, long long overflow_vector, void *context)
 
int _papi_hwi_get_preset_event_info (int EventCode, PAPI_event_info_t *info)
 
int _papi_hwi_get_user_event_info (int EventCode, PAPI_event_info_t *info)
 
int _papi_hwi_derived_type (char *tmp, int *code)
 
int _papi_hwi_query_native_event (unsigned int EventCode)
 
int _papi_hwi_get_native_event_info (unsigned int EventCode, PAPI_event_info_t *info)
 
int _papi_hwi_native_name_to_code (const char *in, int *out)
 
int _papi_hwi_native_code_to_name (unsigned int EventCode, char *hwi_name, int len)
 
int _papi_hwi_invalid_cmp (int cidx)
 
int _papi_hwi_component_index (int event_code)
 
int _papi_hwi_native_to_eventcode (int cidx, int event_code, int ntv_idx, const char *event_name)
 
int _papi_hwi_eventcode_to_native (int event_code)
 

Variables

int papi_num_components
 
int _papi_num_compiled_components
 
int init_level
 
int _papi_hwi_errno
 
int _papi_hwi_num_errors
 
char ** _papi_errlist
 
papi_mdi_t _papi_hwi_system_info
 
int _papi_hwi_error_level
 
int _papi_hwi_using_signal [PAPI_NSIG]
 
PAPI_os_info_t _papi_os_info
 
PAPI_debug_handler_t _papi_hwi_debug_handler
 

Detailed Description

Author
Philip Mucci mucci.nosp@m.@cs..nosp@m.utk.e.nosp@m.du
Dan Terpstra terpstra.utk.edu
Kevin London londo.nosp@m.n@cs.nosp@m..utk..nosp@m.edu
Haihang You you@c.nosp@m.s.ut.nosp@m.k.edu

Definition in file papi_internal.h.

Macro Definition Documentation

#define COMPONENT_LOCK   PAPI_NUM_LOCK+5 /* per-component */

Definition at line 91 of file papi_internal.h.

#define CPUS_LOCK   PAPI_NUM_LOCK+7 /* cpus.c */

Definition at line 93 of file papi_internal.h.

#define DEADBEEF   0xdedbeef

Definition at line 26 of file papi_internal.h.

#define DERIVED_ADD   0x1

Add counters

Definition at line 70 of file papi_internal.h.

#define DERIVED_ADD_PS   0x4

Add 2 counters then divide by the cycle counter and xl8 to secs.

Definition at line 72 of file papi_internal.h.

#define DERIVED_CMPD   0x8

Event lives in operand index but takes 2 or more codes

Definition at line 73 of file papi_internal.h.

#define DERIVED_INFIX   0x40

Process counters based on specified infix string

Definition at line 76 of file papi_internal.h.

#define DERIVED_POSTFIX   0x20

Process counters based on specified postfix string

Definition at line 75 of file papi_internal.h.

#define DERIVED_PS   0x2

Divide by the cycle counter and convert to seconds

Definition at line 71 of file papi_internal.h.

#define DERIVED_SUB   0x10

Sub all counters from counter with operand_index

Definition at line 74 of file papi_internal.h.

#define DONT_NEED_CONTEXT   0

Definition at line 99 of file papi_internal.h.

#define GLOBAL_LOCK   PAPI_NUM_LOCK+6 /* papi.c for global variable (static and non) initialization/shutdown */

Definition at line 92 of file papi_internal.h.

#define HIGHLEVEL_LOCK   PAPI_NUM_LOCK+3 /* papi_hl.c */

Definition at line 89 of file papi_internal.h.

#define hwd_context_t   void

Definition at line 107 of file papi_internal.h.

#define hwd_control_state_t   void

Definition at line 108 of file papi_internal.h.

#define hwd_reg_alloc_t   void

Definition at line 109 of file papi_internal.h.

#define hwd_register_t   void

Definition at line 110 of file papi_internal.h.

#define hwd_siginfo_t   void

Definition at line 111 of file papi_internal.h.

#define hwd_ucontext_t   void

Definition at line 112 of file papi_internal.h.

#define inline_static   inline static

Definition at line 124 of file papi_internal.h.

#define INTERNAL_LOCK   PAPI_NUM_LOCK+0 /* papi_internal.c */

Definition at line 86 of file papi_internal.h.

#define LOWLEVEL_TLS   PAPI_NUM_TLS+0

Definition at line 80 of file papi_internal.h.

#define MEMORY_LOCK   PAPI_NUM_LOCK+4 /* papi_memory.c */

Definition at line 90 of file papi_internal.h.

#define MULTIPLEX_LOCK   PAPI_NUM_LOCK+1 /* multiplex.c */

Definition at line 87 of file papi_internal.h.

#define NAMELIB_LOCK   PAPI_NUM_LOCK+8 /* papi_pfm4_events.c */

Definition at line 94 of file papi_internal.h.

#define NEED_CONTEXT   1

Definition at line 98 of file papi_internal.h.

#define NOT_DERIVED   0x0

Do nothing

Definition at line 69 of file papi_internal.h.

#define NUM_INNER_TLS   1

Definition at line 81 of file papi_internal.h.

#define PAPI_ERROR_CODE_str   "Error Code"

Definition at line 41 of file papi_internal.h.

#define PAPI_EVENTS_IN_DERIVED_EVENT   8

Definition at line 101 of file papi_internal.h.

#define PAPI_INT_ITIMER   ITIMER_PROF

Definition at line 54 of file papi_internal.h.

#define PAPI_INT_ITIMER_MS   1

Definition at line 56 of file papi_internal.h.

#define PAPI_INT_MPX_DEF_US   10000 /*Default resolution in us. of mpx handler */

Definition at line 65 of file papi_internal.h.

#define PAPI_INT_MPX_SIGNAL   SIGPROF

Definition at line 52 of file papi_internal.h.

#define PAPI_INT_SIGNAL   SIGPROF

Definition at line 53 of file papi_internal.h.

#define PAPI_MAX_TLS   (NUM_INNER_TLS+PAPI_NUM_TLS)

Definition at line 82 of file papi_internal.h.

#define PAPI_NSIG   128

Definition at line 60 of file papi_internal.h.

#define PAPI_SHUTDOWN_str   "PAPI_shutdown: PAPI is not initialized"

Definition at line 42 of file papi_internal.h.

#define PAPI_SHUTDOWN_SYNC_str   "PAPI_shutdown: other threads still have running EventSets"

Definition at line 43 of file papi_internal.h.

#define THREADS_LOCK   PAPI_NUM_LOCK+2 /* threads.c */

Definition at line 88 of file papi_internal.h.

Typedef Documentation

Definition at line 364 of file papi_internal.h.

Function Documentation

int _papi_hwi_add_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1330 of file papi_internal.c.

1331 {
1332  INTDBG("ENTER: ESI: %p (%d), EventCode: %#x\n", ESI, ESI->EventSetIndex, EventCode);
1333 
1334  int i, j, thisindex, remap, retval = PAPI_OK;
1335  int cidx;
1336 
1337  cidx=_papi_hwi_component_index( EventCode );
1338  if (cidx<0) return PAPI_ENOCMP;
1339 
1340  /* Sanity check that the new EventCode is from the same component */
1341  /* as previous events. */
1342 
1343  if ( ESI->CmpIdx < 0 ) {
1344  if ( ( retval = _papi_hwi_assign_eventset( ESI, cidx)) != PAPI_OK ) {
1345  INTDBG("EXIT: Error assigning eventset to component index %d\n", cidx);
1346  return retval;
1347  }
1348  } else {
1349  if ( ESI->CmpIdx != cidx ) {
1350  INTDBG("EXIT: Event is not valid for component index %d\n", cidx);
1351  return PAPI_EINVAL;
1352  }
1353  }
1354 
1355  /* Make sure the event is not present and get the next free slot. */
1356  thisindex = get_free_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1357  if ( thisindex < PAPI_OK ) {
1358  return thisindex;
1359  }
1360 
1361  INTDBG("Adding event to slot %d of EventSet %d\n",thisindex,ESI->EventSetIndex);
1362 
1363  /* If it is a software MPX EventSet, add it to the multiplex data structure */
1364  /* and this thread's multiplex list */
1365 
1366  if ( !_papi_hwi_is_sw_multiplex( ESI ) ) {
1367 
1368  /* Handle preset case */
1369  if ( IS_PRESET(EventCode) ) {
1370  int count;
1371  int preset_index = EventCode & ( int ) PAPI_PRESET_AND_MASK;
1372 
1373  /* Check if it's within the valid range */
1374  if ( ( preset_index < 0 ) || ( preset_index >= PAPI_MAX_PRESET_EVENTS ) ) {
1375  return PAPI_EINVAL;
1376  }
1377 
1378  /* count the number of native events in this preset */
1379  count = ( int ) _papi_hwi_presets[preset_index].count;
1380 
1381  /* Check if event exists */
1382  if ( !count ) {
1383  return PAPI_ENOEVNT;
1384  }
1385 
1386  /* check if the native events have been used as overflow events */
1387  /* this is not allowed */
1388  if ( ESI->state & PAPI_OVERFLOWING ) {
1389  for( i = 0; i < count; i++ ) {
1390  for( j = 0; j < ESI->overflow.event_counter; j++ ) {
1391  if ( ESI->overflow.EventCode[j] ==(int)
1392  ( _papi_hwi_presets[preset_index].code[i] ) ) {
1393  return PAPI_ECNFLCT;
1394  }
1395  }
1396  }
1397  }
1398 
1399  /* Try to add the preset. */
1400 
1401  remap = add_native_events( ESI,
1402  _papi_hwi_presets[preset_index].code,
1403  count, &ESI->EventInfoArray[thisindex] );
1404  if ( remap < 0 ) {
1405  return remap;
1406  }
1407  else {
1408  /* Fill in the EventCode (machine independent) information */
1409  ESI->EventInfoArray[thisindex].event_code =
1410  ( unsigned int ) EventCode;
1411  ESI->EventInfoArray[thisindex].derived =
1412  _papi_hwi_presets[preset_index].derived_int;
1413  ESI->EventInfoArray[thisindex].ops =
1414  _papi_hwi_presets[preset_index].postfix;
1415  ESI->NumberOfEvents++;
1417 
1418  }
1419  }
1420  /* Handle adding Native events */
1421  else if ( IS_NATIVE(EventCode) ) {
1422 
1423  /* Check if native event exists */
1424  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) != PAPI_OK ) {
1425  return PAPI_ENOEVNT;
1426  }
1427 
1428  /* check if the native events have been used as overflow events */
1429  /* This is not allowed */
1430  if ( ESI->state & PAPI_OVERFLOWING ) {
1431  for( j = 0; j < ESI->overflow.event_counter; j++ ) {
1432  if ( EventCode == ESI->overflow.EventCode[j] ) {
1433  return PAPI_ECNFLCT;
1434  }
1435  }
1436  }
1437 
1438  /* Try to add the native event. */
1439 
1440  remap = add_native_events( ESI, (unsigned int *)&EventCode, 1,
1441  &ESI->EventInfoArray[thisindex] );
1442 
1443  if ( remap < 0 ) {
1444  return remap;
1445  } else {
1446 
1447  /* Fill in the EventCode (machine independent) information */
1448  ESI->EventInfoArray[thisindex].event_code =
1449  ( unsigned int ) EventCode;
1450  ESI->NumberOfEvents++;
1452 
1453  }
1454  } else if ( IS_USER_DEFINED( EventCode ) ) {
1455  int count;
1456  int index = EventCode & PAPI_UE_AND_MASK;
1457 
1458  if ( index < 0 || index >= user_defined_events_count )
1459  return ( PAPI_EINVAL );
1460 
1461  count = ( int ) user_defined_events[index].count;
1462 
1463  for ( i = 0; i < count; i++ ) {
1464  for ( j = 0; j < ESI->overflow.event_counter; j++ ) {
1465  if ( ESI->overflow.EventCode[j] ==
1466  (int)(user_defined_events[index].code[i]) ) {
1467  return ( PAPI_EBUG );
1468  }
1469  }
1470  }
1471 
1472  remap = add_native_events( ESI,
1473  user_defined_events[index].code,
1474  count, &ESI->EventInfoArray[thisindex] );
1475 
1476  if ( remap < 0 ) {
1477  return remap;
1478  } else {
1479  ESI->EventInfoArray[thisindex].event_code = (unsigned int) EventCode;
1480  ESI->EventInfoArray[thisindex].derived = user_defined_events[index].derived_int;
1481  ESI->EventInfoArray[thisindex].ops = user_defined_events[index].postfix;
1482  ESI->NumberOfEvents++;
1484  }
1485  } else {
1486 
1487  /* not Native, Preset, or User events */
1488 
1489  return PAPI_EBUG;
1490  }
1491  }
1492  else {
1493 
1494  /* Multiplexing is special. See multiplex.c */
1495 
1496  retval = mpx_add_event( &ESI->multiplex.mpx_evset, EventCode,
1497  ESI->domain.domain,
1498  ESI->granularity.granularity );
1499 
1500 
1501  if ( retval < PAPI_OK ) {
1502  return retval;
1503  }
1504 
1505  /* Relevant (???) */
1506  ESI->EventInfoArray[thisindex].event_code = ( unsigned int ) EventCode;
1507  ESI->EventInfoArray[thisindex].derived = NOT_DERIVED;
1508 
1509  ESI->NumberOfEvents++;
1510 
1511  /* event is in the EventInfoArray but not mapped to the NativeEvents */
1512  /* this causes issues if you try to set overflow on the event. */
1513  /* in theory this wouldn't matter anyway. */
1514  }
1515 
1516  /* reinstate the overflows if any */
1517  retval=update_overflow( ESI );
1518 
1519  return retval;
1520 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_ENOEVNT
Definition: papi.h:260
#define PAPI_OVERFLOWING
Definition: papi.h:378
#define IS_PRESET(EventCode)
Definition: papi.h:229
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:230
#define PAPI_UE_AND_MASK
int _papi_hwi_query_native_event(unsigned int EventCode)
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_MAX_PRESET_EVENTS
EventSetDomainInfo_t domain
#define PAPI_EBUG
Definition: papi.h:259
return PAPI_OK
Definition: linux-nvml.c:497
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:436
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define IS_NATIVE(EventCode)
Definition: papi.h:228
#define NOT_DERIVED
Definition: papi_internal.h:69
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
int user_defined_events_count
Definition: papi_internal.c:60
hwi_presets_t user_defined_events[PAPI_MAX_USER_EVENTS]
Definition: papi_internal.c:59
static int update_overflow(EventSetInfo_t *ESI)
#define PAPI_ECNFLCT
Definition: papi.h:261
int mpx_add_event(MPX_EventSet **mpx_events, int EventCode, int domain, int granularity)
Definition: sw_multiplex.c:305
EventInfo_t * EventInfoArray
#define PAPI_ENOCMP
Definition: papi.h:270
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
int _papi_hwi_assign_eventset(EventSetInfo_t *ESI, int cidx)
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
int _papi_hwi_component_index(int event_code)
unsigned int event_code
#define PAPI_PRESET_AND_MASK
static int add_native_events(EventSetInfo_t *ESI, unsigned int *nevt, int size, EventInfo_t *out)
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
static int get_free_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
void _papi_hwi_map_events_to_native(EventSetInfo_t *ESI)
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_assign_eventset ( EventSetInfo_t ESI,
int  cidx 
)

Definition at line 755 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_cleanup_eventset ( EventSetInfo_t ESI)

Definition at line 1744 of file papi_internal.c.

1745 {
1746  int i, j, num_cntrs, retval;
1747  hwd_context_t *context;
1748  int EventCode;
1750  if ( !_papi_hwi_invalid_cmp( ESI->CmpIdx ) ) {
1751  num_cntrs = _papi_hwd[ESI->CmpIdx]->cmp_info.num_mpx_cntrs;
1752 
1753  for(i=0;i<num_cntrs;i++) {
1754 
1755  EventCode=ESI->EventInfoArray[i].event_code;
1756 
1757  /* skip if event not there */
1758  if ( EventCode == PAPI_NULL ) continue;
1759 
1760  /* If it is a MPX EventSet, remove it from the multiplex */
1761  /* data structure and this thread's multiplex list */
1762 
1763  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1764  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1765  if ( retval < PAPI_OK )
1766  return retval;
1767  } else {
1768 
1769  native = ESI->NativeInfoArray;
1770 
1771  /* clear out ESI->NativeInfoArray */
1772  /* do we really need to do this, seeing as we free() it later? */
1773 
1774  for( j = 0; j < ESI->NativeCount; j++ ) {
1775  native[j].ni_event = -1;
1776  native[j].ni_position = -1;
1777  native[j].ni_owners = 0;
1778  /* native[j].ni_bits?? */
1779  }
1780  }
1781 
1782  /* do we really need to do this, seeing as we free() it later? */
1783  ESI->EventInfoArray[i].event_code= ( unsigned int ) PAPI_NULL;
1784  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
1785  ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
1786  }
1787  ESI->EventInfoArray[i].ops = NULL;
1789  }
1790 
1791  context = _papi_hwi_get_context( ESI, NULL );
1792  /* calling with count of 0 equals a close? */
1793  retval = _papi_hwd[ESI->CmpIdx]->update_control_state( ESI->ctl_state,
1794  NULL, 0, context);
1795  if (retval!=PAPI_OK) {
1796  return retval;
1797  }
1798  }
1799 
1800  ESI->CmpIdx = -1;
1801  ESI->NumberOfEvents = 0;
1802  ESI->NativeCount = 0;
1803 
1804  if ( ( ESI->state & PAPI_MULTIPLEXING ) && ESI->multiplex.mpx_evset )
1805  papi_free( ESI->multiplex.mpx_evset );
1806 
1807  if ( ( ESI->state & PAPI_CPU_ATTACH ) && ESI->CpuInfo )
1809 
1810  if ( ESI->ctl_state )
1811  papi_free( ESI->ctl_state );
1812 
1813  if ( ESI->sw_stop )
1814  papi_free( ESI->sw_stop );
1815 
1816  if ( ESI->hw_start )
1817  papi_free( ESI->hw_start );
1818 
1819  if ( ESI->EventInfoArray )
1820  papi_free( ESI->EventInfoArray );
1821 
1822  if ( ESI->NativeInfoArray )
1823  papi_free( ESI->NativeInfoArray );
1824 
1825  if ( ESI->NativeBits )
1826  papi_free( ESI->NativeBits );
1827 
1828  if ( ESI->overflow.deadline )
1829  papi_free( ESI->overflow.deadline );
1830 
1831  if ( ESI->profile.prof )
1832  papi_free( ESI->profile.prof );
1833 
1834  ESI->ctl_state = NULL;
1835  ESI->sw_stop = NULL;
1836  ESI->hw_start = NULL;
1837  ESI->EventInfoArray = NULL;
1838  ESI->NativeInfoArray = NULL;
1839  ESI->NativeBits = NULL;
1840 
1841  memset( &ESI->domain, 0x0, sizeof(EventSetDomainInfo_t) );
1842  memset( &ESI->granularity, 0x0, sizeof(EventSetGranularityInfo_t) );
1843  memset( &ESI->overflow, 0x0, sizeof(EventSetOverflowInfo_t) );
1844  memset( &ESI->multiplex, 0x0, sizeof(EventSetMultiplexInfo_t) );
1845  memset( &ESI->attach, 0x0, sizeof(EventSetAttachInfo_t) );
1846  memset( &ESI->cpu, 0x0, sizeof(EventSetCpuInfo_t) );
1847  memset( &ESI->profile, 0x0, sizeof(EventSetProfileInfo_t) );
1848  memset( &ESI->inherit, 0x0, sizeof(EventSetInheritInfo_t) );
1849 
1850  ESI->CpuInfo = NULL;
1851 
1852  return PAPI_OK;
1853 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_CPU_ATTACH
Definition: papi.h:457
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define papi_free(a)
Definition: papi_memory.h:35
#define PAPI_NULL
Definition: papi.h:292
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
EventSetAttachInfo_t attach
#define PAPI_MULTIPLEXING
Definition: papi.h:380
hwd_register_t * NativeBits
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:497
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
EventSetInheritInfo_t inherit
struct _CpuInfo * CpuInfo
#define NOT_DERIVED
Definition: papi_internal.h:69
PAPI_sprofil_t ** prof
static int native
int _papi_hwi_shutdown_cpu(CpuInfo_t *cpu)
Definition: cpus.c:306
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
long long * hw_start
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
hwd_context_t * _papi_hwi_get_context(EventSetInfo_t *ESI, int *is_dirty)
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
long long * sw_stop
int mpx_remove_event(MPX_EventSet **mpx_events, int EventCode)
Definition: sw_multiplex.c:418
int
Definition: iozone.c:18528
int(* update_control_state)(hwd_control_state_t *, NativeInfo_t *, int, hwd_context_t *)
Definition: papi_vector.h:38
unsigned int event_code
int _papi_hwi_invalid_cmp(int cidx)
EventSetProfileInfo_t profile
hwd_control_state_t * ctl_state
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
EventSetCpuInfo_t cpu

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_component_index ( int  event_code)

Definition at line 515 of file papi_internal.c.

515  {
516  INTDBG("ENTER: event_code: %#x\n", event_code);
517 
518  int cidx;
519  int event_index;
520 
521  /* currently assume presets are for component 0 only */
522  if (IS_PRESET(event_code)) {
523  INTDBG("EXIT: Event %#x is a PRESET, assigning component %d\n", event_code,0);
524  return 0;
525  }
526 
527  /* user defined events are treated like preset events (component 0 only) */
528  if (IS_USER_DEFINED(event_code)) {
529  INTDBG("EXIT: Event %#x is USER DEFINED, assigning component %d\n", event_code,0);
530  return 0;
531  }
532 
533  event_index=event_code&PAPI_NATIVE_AND_MASK;
534 
535  if ( (event_index < 0) || (event_index>=num_native_events)) {
536  INTDBG("EXIT: Event index %#x is out of range, num_native_events: %d\n", event_index, num_native_events);
537  return PAPI_ENOEVNT;
538  }
539 
540  cidx=_papi_native_events[event_index].cidx;
541 
542  if ((cidx<0) || (cidx >= papi_num_components)) {
543  INTDBG("EXIT: Component index %#x is out of range, papi_num_components: %d\n", cidx, papi_num_components);
544  return PAPI_ENOCMP;
545  }
546 
547  INTDBG("EXIT: Found cidx: %d event_index: %d, event_code: %#x\n", cidx, event_index, event_code);
548  return cidx;
549 }
#define PAPI_ENOEVNT
Definition: papi.h:260
#define IS_PRESET(EventCode)
Definition: papi.h:229
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:77
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:230
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
#define PAPI_ENOCMP
Definition: papi.h:270
int papi_num_components
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:78

Here is the caller graph for this function:

int _papi_hwi_convert_eventset_to_multiplex ( _papi_int_multiplex_t mpx)

Definition at line 1856 of file papi_internal.c.

1857 {
1858  int retval, i, j = 0, *mpxlist = NULL;
1859  EventSetInfo_t *ESI = mpx->ESI;
1860  int flags = mpx->flags;
1861 
1862  /* If there are any events in the EventSet,
1863  convert them to multiplex events */
1864 
1865  if ( ESI->NumberOfEvents ) {
1866 
1867  mpxlist =
1868  ( int * ) papi_malloc( sizeof ( int ) *
1869  ( size_t ) ESI->NumberOfEvents );
1870  if ( mpxlist == NULL )
1871  return ( PAPI_ENOMEM );
1872 
1873  /* Build the args to MPX_add_events(). */
1874 
1875  /* Remember the EventInfoArray can be sparse
1876  and the data can be non-contiguous */
1877 
1878  for ( i = 0; i < EventInfoArrayLength( ESI ); i++ )
1879  if ( ESI->EventInfoArray[i].event_code !=
1880  ( unsigned int ) PAPI_NULL )
1881  mpxlist[j++] = ( int ) ESI->EventInfoArray[i].event_code;
1882 
1883  /* Resize the EventInfo_t array */
1884 
1885  if ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex == 0 ) ||
1886  ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) &&
1887  ( flags & PAPI_MULTIPLEX_FORCE_SW ) ) ) {
1888  retval =
1889  MPX_add_events( &ESI->multiplex.mpx_evset, mpxlist, j,
1890  ESI->domain.domain,
1891  ESI->granularity.granularity );
1892  if ( retval != PAPI_OK ) {
1893  papi_free( mpxlist );
1894  return ( retval );
1895  }
1896  }
1897 
1898  papi_free( mpxlist );
1899  }
1900 
1901  /* Update the state before initialization! */
1902 
1903  ESI->state |= PAPI_MULTIPLEXING;
1904  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex &&
1905  ( flags & PAPI_MULTIPLEX_FORCE_SW ) )
1907  ESI->multiplex.ns = ( int ) mpx->ns;
1908 
1909  return ( PAPI_OK );
1910 }
static int EventInfoArrayLength(const EventSetInfo_t *ESI)
long long flags
Definition: iozone.c:12330
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
#define PAPI_NULL
Definition: papi.h:292
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_MULTIPLEXING
Definition: papi.h:380
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:419
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:497
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
int MPX_add_events(MPX_EventSet **mpx_events, int *event_list, int num_events, int domain, int granularity)
Definition: sw_multiplex.c:676
int i
Definition: fileop.c:140
unsigned int kernel_multiplex
Definition: papi.h:656
EventInfo_t * EventInfoArray
#define PAPI_ENOMEM
Definition: papi.h:254
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
int
Definition: iozone.c:18528
unsigned int event_code
EventSetInfo_t * ESI
return
Definition: iozone.c:22170
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_create_eventset ( int EventSet,
ThreadInfo_t handle 
)

Definition at line 932 of file papi_internal.c.

933 {
934  EventSetInfo_t *ESI;
935  int retval;
936 
937  /* Is the EventSet already in existence? */
938 
939  if ( ( EventSet == NULL ) || ( handle == NULL ) )
940  return PAPI_EINVAL;
941 
942  if ( *EventSet != PAPI_NULL )
943  return PAPI_EINVAL;
944 
945  /* Well, then allocate a new one. Use n to keep track of a NEW EventSet */
946 
947  retval = create_EventSet( &ESI );
948  if ( retval != PAPI_OK )
949  return retval;
950 
951  ESI->CmpIdx = -1; /* when eventset is created, it is not decided yet which component it belongs to, until first event is added */
952  ESI->state = PAPI_STOPPED;
953 
954  /* Add it to the global table */
955 
956  retval = add_EventSet( ESI, handle );
957  if ( retval < PAPI_OK ) {
959  return retval ;
960  }
961 
962  *EventSet = ESI->EventSetIndex;
963 
964  INTDBG( "(%p,%p): new EventSet in slot %d\n",
965  ( void * ) EventSet, handle, *EventSet );
966 
967  return retval;
968 }
#define PAPI_NULL
Definition: papi.h:292
int EventSet
return PAPI_OK
Definition: linux-nvml.c:497
return PAPI_EINVAL
Definition: linux-nvml.c:436
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_STOPPED
Definition: papi.h:374
void _papi_hwi_free_EventSet(EventSetInfo_t *ESI)
ssize_t retval
Definition: libasync.c:338
static int create_EventSet(EventSetInfo_t **here)
static int add_EventSet(EventSetInfo_t *ESI, ThreadInfo_t *master)

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_derived_type ( char *  tmp,
int code 
)

Definition at line 2219 of file papi_internal.c.

2220 {
2221  int i = 0;
2222  while ( _papi_hwi_derived[i].name != NULL ) {
2223  if ( strcasecmp( tmp, _papi_hwi_derived[i].name ) == 0 ) {
2224  *code = _papi_hwi_derived[i].value;
2225  return PAPI_OK;
2226  }
2227  i++;
2228  }
2229  INTDBG( "Invalid derived string %s\n", tmp );
2230  return PAPI_EINVAL;
2231 }
return PAPI_OK
Definition: linux-nvml.c:497
return PAPI_EINVAL
Definition: linux-nvml.c:436
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static const hwi_describe_t _papi_hwi_derived[]
char * name
Definition: iozone.c:23648
long long tmp
Definition: iozone.c:12031

Here is the caller graph for this function:

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

Definition at line 2013 of file papi_internal.c.

2015 {
2016  /* This function is not used and shouldn't be called. */
2017  ( void ) EventSet; /*unused */
2018  ( void ) address; /*unused */
2019  ( void ) overflow_vector; /*unused */
2020  ( void ) context; /*unused */
2021  return;
2022 }
int EventSet
void
Definition: iozone.c:18627

Here is the caller graph for this function:

int _papi_hwi_eventcode_to_native ( int  event_code)

Definition at line 576 of file papi_internal.c.

576  {
577  INTDBG("ENTER: event_code: %#x\n", event_code);
578 
579  int result;
580  int event_index;
581 
582  event_index=event_code&PAPI_NATIVE_AND_MASK;
583  if ((event_index < 0) || (event_index>=num_native_events)) {
584  INTDBG("EXIT: PAPI_ENOEVNT\n");
585  return PAPI_ENOEVNT;
586  }
587 
588  result=_papi_native_events[event_index].component_event;
589 
590  INTDBG("EXIT: result: %#x\n", result);
591  return result;
592 
593 }
#define PAPI_ENOEVNT
Definition: papi.h:260
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:77
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:78

Here is the caller graph for this function:

void _papi_hwi_free_EventSet ( EventSetInfo_t ESI)

Definition at line 887 of file papi_internal.c.

888 {
890 
891 #ifdef DEBUG
892  memset( ESI, 0x00, sizeof ( EventSetInfo_t ) );
893 #endif
894  papi_free( ESI );
895 
896 }
#define papi_free(a)
Definition: papi_memory.h:35
int _papi_hwi_cleanup_eventset(EventSetInfo_t *ESI)

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_free_papi_event_string ( )

Definition at line 107 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

hwd_context_t* _papi_hwi_get_context ( EventSetInfo_t ESI,
int is_dirty 
)

Definition at line 2663 of file papi_internal.c.

2664 {
2665  INTDBG("Entry: ESI: %p, is_dirty: %p\n", ESI, is_dirty);
2666  int dirty_ctx;
2667  hwd_context_t *ctx=NULL;
2668 
2669  /* assume for now the control state is clean (last updated by this ESI) */
2670  dirty_ctx = 0;
2671 
2672  /* get a context pointer based on if we are counting for a thread or for a cpu */
2673  if (ESI->state & PAPI_CPU_ATTACHED) {
2674  /* use cpu context */
2675  ctx = ESI->CpuInfo->context[ESI->CmpIdx];
2676 
2677  /* if the user wants to know if the control state was last set by the same event set, tell him */
2678  if (is_dirty != NULL) {
2679  if (ESI->CpuInfo->from_esi != ESI) {
2680  dirty_ctx = 1;
2681  }
2682  *is_dirty = dirty_ctx;
2683  }
2684  ESI->CpuInfo->from_esi = ESI;
2685 
2686  } else {
2687 
2688  /* use thread context */
2689  ctx = ESI->master->context[ESI->CmpIdx];
2690 
2691  /* if the user wants to know if the control state was last set by the same event set, tell him */
2692  if (is_dirty != NULL) {
2693  if (ESI->master->from_esi != ESI) {
2694  dirty_ctx = 1;
2695  }
2696  *is_dirty = dirty_ctx;
2697  }
2698  ESI->master->from_esi = ESI;
2699 
2700  }
2701  return( ctx );
2702 }
#define PAPI_CPU_ATTACHED
Definition: papi.h:382
#define INTDBG(format, args...)
Definition: papi_debug.h:65
struct _CpuInfo * CpuInfo
struct _ThreadInfo * master

Here is the caller graph for this function:

int _papi_hwi_get_native_event_info ( unsigned int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2546 of file papi_internal.c.

2548 {
2549  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2550  int retval;
2551  int cidx;
2552  int nevt_code;
2553 
2554  cidx = _papi_hwi_component_index( EventCode );
2555  if (cidx<0) return PAPI_ENOCMP;
2556 
2557  if (_papi_hwd[cidx]->cmp_info.disabled) return PAPI_ENOCMP;
2558 
2559  if ( EventCode & PAPI_NATIVE_MASK ) {
2560  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2561  _papi_hwi_set_papi_event_code(EventCode, 0);
2562 
2563  /* clear the event info */
2564  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2565  info->event_code = ( unsigned int ) EventCode;
2566  info->component_index = (unsigned int) cidx;
2567  retval = _papi_hwd[cidx]->ntv_code_to_info(
2568  _papi_hwi_eventcode_to_native(EventCode), info);
2569 
2570  /* If component error, it's missing the ntv_code_to_info vector */
2571  /* so we'll have to fake it. */
2572  if ( retval == PAPI_ECMP ) {
2573 
2574 
2575  INTDBG("missing NTV_CODE_TO_INFO, faking\n");
2576  /* Fill in the info structure */
2577 
2578  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2579  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2580  return nevt_code;
2581  }
2582  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2583  (unsigned int)nevt_code,
2584  info->symbol,
2585  sizeof(info->symbol)) ) == PAPI_OK ) {
2586 
2587  } else {
2588  INTDBG("EXIT: retval: %d\n", retval);
2589  return retval;
2590  }
2591 
2592  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) <0) {
2593  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2594  return nevt_code;
2595  }
2596  retval = _papi_hwd[cidx]->ntv_code_to_descr(
2597  (unsigned int)nevt_code,
2598  info->long_descr,
2599  sizeof ( info->long_descr));
2600  if (retval!=PAPI_OK) {
2601  INTDBG("Failed ntv_code_to_descr()\n");
2602  }
2603 
2604  }
2606  _papi_hwd[cidx]->cmp_info.short_name,
2607  info->symbol,
2608  info->symbol,
2609  sizeof(info->symbol) );
2610 
2611  INTDBG("EXIT: retval: %d\n", retval);
2612  return retval;
2613  }
2614 
2615  INTDBG("EXIT: PAPI_ENOEVNT\n");
2616  return PAPI_ENOEVNT;
2617 }
#define PAPI_ENOEVNT
Definition: papi.h:260
#define PAPI_NATIVE_MASK
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:969
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
return PAPI_OK
Definition: linux-nvml.c:497
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
int(* ntv_code_to_info)(unsigned int, PAPI_event_info_t *)
Definition: papi_vector.h:48
#define PAPI_ECMP
Definition: papi.h:256
again struct sockaddr sizeof(struct sockaddr_in))
#define PAPI_ENOCMP
Definition: papi.h:270
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int component_index
Definition: papi.h:974
int
Definition: iozone.c:18528
int _papi_hwi_component_index(int event_code)
int(* ntv_code_to_descr)(unsigned int, char *, int)
Definition: papi_vector.h:46
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
int _papi_hwi_eventcode_to_native(int event_code)
unsigned int event_code
Definition: papi.h:964
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_ntv_idx ( unsigned int  papi_evt_code)

Definition at line 142 of file papi_internal.c.

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

Here is the caller graph for this function:

PAPI_os_info_t* _papi_hwi_get_os_info ( void  )
unsigned int _papi_hwi_get_papi_event_code ( void  )

Definition at line 136 of file papi_internal.c.

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

Here is the caller graph for this function:

char* _papi_hwi_get_papi_event_string ( void  )

Definition at line 102 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_get_preset_event_info ( int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2263 of file papi_internal.c.

2264 {
2265  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2266 
2267  int i = EventCode & PAPI_PRESET_AND_MASK;
2268  unsigned int j;
2269 
2270  if ( _papi_hwi_presets[i].symbol ) { /* if the event is in the preset table */
2271  // since we are setting the whole structure to zero the strncpy calls below will
2272  // be leaving NULL terminates strings as long as they copy 1 less byte than the
2273  // buffer size of the field.
2274  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2275 
2276  info->event_code = ( unsigned int ) EventCode;
2277  strncpy( info->symbol, _papi_hwi_presets[i].symbol,
2278  sizeof(info->symbol)-1);
2279 
2280  if ( _papi_hwi_presets[i].short_descr != NULL )
2281  strncpy( info->short_descr, _papi_hwi_presets[i].short_descr,
2282  sizeof ( info->short_descr )-1 );
2283 
2284  if ( _papi_hwi_presets[i].long_descr != NULL )
2285  strncpy( info->long_descr, _papi_hwi_presets[i].long_descr,
2286  sizeof ( info->long_descr )-1 );
2287 
2289  info->count = _papi_hwi_presets[i].count;
2290 
2292  info->derived, sizeof ( info->derived ) );
2293 
2294  if ( _papi_hwi_presets[i].postfix != NULL )
2295  strncpy( info->postfix, _papi_hwi_presets[i].postfix,
2296  sizeof ( info->postfix )-1 );
2297 
2298  for(j=0;j < info->count; j++) {
2299  info->code[j]=_papi_hwi_presets[i].code[j];
2300  strncpy(info->name[j], _papi_hwi_presets[i].name[j],
2301  sizeof(info->name[j])-1);
2302  }
2303 
2304  if ( _papi_hwi_presets[i].note != NULL ) {
2305  strncpy( info->note, _papi_hwi_presets[i].note,
2306  sizeof ( info->note )-1 );
2307  }
2308 
2309  return PAPI_OK;
2310  } else {
2311  return PAPI_ENOEVNT;
2312  }
2313 }
#define PAPI_ENOEVNT
Definition: papi.h:260
unsigned int count
Definition: papi.h:987
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:969
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
static int _papi_hwi_derived_string(int type, char *derived, int len)
return PAPI_OK
Definition: linux-nvml.c:497
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1013
#define INTDBG(format, args...)
Definition: papi_debug.h:65
unsigned int event_type
Definition: papi_preset.h:30
int i
Definition: fileop.c:140
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:967
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
unsigned int event_type
Definition: papi.h:992
char * short_descr
Definition: papi_preset.h:25
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi.h:1003
again struct sockaddr sizeof(struct sockaddr_in))
char * long_descr
Definition: papi_preset.h:26
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
char * name[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:33
#define PAPI_PRESET_AND_MASK
long j
Definition: iozone.c:19135
unsigned int event_code
Definition: papi.h:964
char * symbol
Definition: papi_preset.h:24
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:995
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:998
unsigned int count
Definition: papi_preset.h:29
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1009
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_user_event_info ( int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2323 of file papi_internal.c.

2324 {
2325  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2326 
2327  unsigned int i = EventCode & PAPI_UE_AND_MASK;
2328  unsigned int j;
2329 
2330  // if event code not in valid range, return error
2331  if (i >= PAPI_MAX_USER_EVENTS) {
2332  INTDBG("EXIT: Invalid event index: %d, max value is: %d\n", i, PAPI_MAX_USER_EVENTS - 1);
2333  return( PAPI_ENOEVNT );
2334  }
2335 
2336  if ( user_defined_events[i].symbol == NULL) { /* if the event is in the preset table */
2337  INTDBG("EXIT: Event symbol for this event is NULL\n");
2338  return PAPI_ENOEVNT;
2339  }
2340 
2341  /* set whole structure to 0 */
2342  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2343 
2344  info->event_code = ( unsigned int ) EventCode;
2345  strncpy( info->symbol, user_defined_events[i].symbol,
2346  sizeof(info->symbol)-1);
2347 
2348  if ( user_defined_events[i].short_descr != NULL )
2349  strncpy( info->short_descr, user_defined_events[i].short_descr,
2350  sizeof(info->short_descr)-1);
2351 
2352  if ( user_defined_events[i].long_descr != NULL )
2353  strncpy( info->long_descr, user_defined_events[i].long_descr,
2354  sizeof(info->long_descr)-1);
2355 
2356 // info->event_type = user_defined_events[i].event_type;
2357  info->count = user_defined_events[i].count;
2358 
2360  info->derived, sizeof(info->derived)-1);
2361 
2362  if ( user_defined_events[i].postfix != NULL )
2363  strncpy( info->postfix, user_defined_events[i].postfix,
2364  sizeof(info->postfix)-1);
2365 
2366  for(j=0;j < info->count; j++) {
2367  info->code[j]=user_defined_events[i].code[j];
2368  INTDBG("info->code[%d]: %#x\n", j, info->code[j]);
2369  strncpy(info->name[j], user_defined_events[i].name[j], sizeof(info->name[j])-1);
2370  }
2371 
2372  if ( user_defined_events[i].note != NULL ) {
2373  strncpy( info->note, user_defined_events[i].note, sizeof(info->note)-1);
2374  }
2375 
2376  INTDBG("EXIT: PAPI_OK: event_code: %#x, symbol: %s, short_desc: %s, long_desc: %s\n", info->event_code, info->symbol, info->short_descr, info->long_descr);
2377  return PAPI_OK;
2378 }
#define PAPI_ENOEVNT
Definition: papi.h:260
unsigned int count
Definition: papi.h:987
#define PAPI_UE_AND_MASK
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:969
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
static int _papi_hwi_derived_string(int type, char *derived, int len)
return PAPI_OK
Definition: linux-nvml.c:497
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1013
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_MAX_USER_EVENTS
int i
Definition: fileop.c:140
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:967
hwi_presets_t user_defined_events[PAPI_MAX_USER_EVENTS]
Definition: papi_internal.c:59
char * short_descr
Definition: papi_preset.h:25
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi.h:1003
char * long_descr
Definition: papi_preset.h:26
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
char * name[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:33
long j
Definition: iozone.c:19135
unsigned int event_code
Definition: papi.h:964
char * symbol
Definition: papi_preset.h:24
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:995
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:998
unsigned int count
Definition: papi_preset.h:29
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1009
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_init_errors ( void  )

Definition at line 478 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global ( void  )

Definition at line 1922 of file papi_internal.c.

1923 {
1924  int retval, i = 0;
1925 
1927  if ( retval != PAPI_OK ) {
1928  return retval;
1929  }
1930 
1931  while ( _papi_hwd[i] ) {
1932 
1933  retval = _papi_hwi_innoculate_vector( _papi_hwd[i] );
1934  if ( retval != PAPI_OK ) {
1935  return retval;
1936  }
1937 
1938  /* We can be disabled by user before init */
1939  if (!_papi_hwd[i]->cmp_info.disabled) {
1940  retval = _papi_hwd[i]->init_component( i );
1942 
1943  /* Do some sanity checking */
1944  if (retval==PAPI_OK) {
1945  if (_papi_hwd[i]->cmp_info.num_cntrs >
1947  fprintf(stderr,"Warning! num_cntrs %d is more than num_mpx_cntrs %d for component %s\n",
1948  _papi_hwd[i]->cmp_info.num_cntrs,
1950  _papi_hwd[i]->cmp_info.name);
1951  }
1952 
1953  }
1954  }
1955 
1956  i++;
1957  }
1958  return PAPI_OK;
1959 }
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:629
int _papi_hwi_innoculate_os_vector(papi_os_vector_t *v)
Definition: papi_vector.c:200
return PAPI_OK
Definition: linux-nvml.c:497
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
int i
Definition: fileop.c:140
int _papi_hwi_innoculate_vector(papi_vector_t *v)
Definition: papi_vector.c:109
ssize_t retval
Definition: libasync.c:338
int(* init_component)(int)
Definition: papi_vector.h:35

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global_internal ( void  )

Definition at line 1965 of file papi_internal.c.

1966 {
1967 
1968  int retval;
1969 
1970  memset(&_papi_hwi_system_info,0x0,sizeof( _papi_hwi_system_info ));
1971 
1972  memset( _papi_hwi_using_signal,0x0,sizeof( _papi_hwi_using_signal ));
1973 
1974  /* Global struct to maintain EventSet mapping */
1976  if ( retval != PAPI_OK ) {
1977  return retval;
1978  }
1979 
1980  _papi_hwi_system_info.pid = 0; /* Process identifier */
1981 
1982  /* PAPI_hw_info_t struct */
1983  memset(&(_papi_hwi_system_info.hw_info),0x0,sizeof(PAPI_hw_info_t));
1984 
1985  return PAPI_OK;
1986 }
int _papi_hwi_using_signal[PAPI_NSIG]
Definition: extras.c:365
Hardware info structure.
Definition: papi.h:780
return PAPI_OK
Definition: linux-nvml.c:497
DynamicArray_t global_eventset_map
static int allocate_eventset_map(DynamicArray_t *map)
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
PAPI_hw_info_t hw_info
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_os ( void  )

Definition at line 1213 of file aix.c.

1213  {
1214 
1215  struct utsname uname_buffer;
1216 
1217  uname(&uname_buffer);
1218 
1219  strncpy(_papi_os_info.name,uname_buffer.sysname,PAPI_MAX_STR_LEN);
1220 
1221  strncpy(_papi_os_info.version,uname_buffer.release,PAPI_MAX_STR_LEN);
1222 
1227 
1228  return PAPI_OK;
1229 
1230 }
#define PAPI_INT_MPX_DEF_US
Definition: papi_internal.h:65
return PAPI_OK
Definition: linux-nvml.c:497
char name[PAPI_MAX_STR_LEN]
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
#define PAPI_INT_ITIMER
Definition: papi_internal.h:54
char version[PAPI_MAX_STR_LEN]
#define PAPI_INT_MPX_SIGNAL
Definition: papi_internal.h:52
#define PAPI_MAX_STR_LEN
Definition: papi.h:465

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_invalid_cmp ( int  cidx)

Definition at line 508 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_is_sw_multiplex ( EventSetInfo_t ESI)

Definition at line 2639 of file papi_internal.c.

2640 {
2641  /* Are we multiplexing at all */
2642  if ( ( ESI->state & PAPI_MULTIPLEXING ) == 0 ) {
2643  return 0;
2644  }
2645 
2646  /* Does the component support kernel multiplexing */
2647  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) {
2648  /* Have we forced software multiplexing */
2649  if ( ESI->multiplex.flags == PAPI_MULTIPLEX_FORCE_SW ) {
2650  return 1;
2651  }
2652  /* Nope, using hardware multiplexing */
2653  return 0;
2654  }
2655 
2656  /* We are multiplexing but the component does not support hardware */
2657 
2658  return 1;
2659 
2660 }
#define PAPI_MULTIPLEXING
Definition: papi.h:380
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:419
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
unsigned int kernel_multiplex
Definition: papi.h:656
EventSetMultiplexInfo_t multiplex

Here is the caller graph for this function:

int _papi_hwi_lookup_EventCodeIndex ( const EventSetInfo_t ESI,
unsigned int  EventCode 
)

Definition at line 1000 of file papi_internal.c.

1002 {
1003  int i;
1004  int limit = EventInfoArrayLength( ESI );
1005 
1006  for ( i = 0; i < limit; i++ ) {
1007  if ( ESI->EventInfoArray[i].event_code == EventCode ) {
1008  return i;
1009  }
1010  }
1011 
1012  return PAPI_EINVAL;
1013 }
static int EventInfoArrayLength(const EventSetInfo_t *ESI)
return PAPI_EINVAL
Definition: linux-nvml.c:436
int i
Definition: fileop.c:140
EventInfo_t * EventInfoArray
unsigned int event_code

Here is the call graph for this function:

Here is the caller graph for this function:

EventSetInfo_t* _papi_hwi_lookup_EventSet ( int  eventset)

Definition at line 2620 of file papi_internal.c.

2621 {
2623  EventSetInfo_t *set;
2624 
2625  if ( ( eventset < 0 ) || ( eventset > map->totalSlots ) )
2626  return ( NULL );
2627 
2628  set = map->dataSlotArray[eventset];
2629 #ifdef DEBUG
2630  if ( ( ISLEVEL( DEBUG_THREADS ) ) && ( _papi_hwi_thread_id_fn ) &&
2631  ( set->master->tid != _papi_hwi_thread_id_fn( ) ) )
2632  return ( NULL );
2633 #endif
2634 
2635  return ( set );
2636 }
DynamicArray_t global_eventset_map
struct _ThreadInfo * master
unsigned long int(* _papi_hwi_thread_id_fn)(void)
Definition: threads.c:42
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
EventSetInfo_t ** dataSlotArray
#define ISLEVEL(a)
Definition: papi_debug.h:54
#define DEBUG_THREADS
Definition: papi_debug.h:30

Here is the caller graph for this function:

void _papi_hwi_map_events_to_native ( EventSetInfo_t ESI)

Definition at line 1080 of file papi_internal.c.

1081 {
1082  INTDBG("ENTER: ESI: %p, ESI->EventInfoArray: %p, ESI->NativeInfoArray: %p, ESI->NumberOfEvents: %d, ESI->NativeCount: %d\n", ESI, ESI->EventInfoArray, ESI->NativeInfoArray, ESI->NumberOfEvents, ESI->NativeCount);
1083 
1084  int i, event, k, n, preset_index = 0, nevt;
1085  int total_events = ESI->NumberOfEvents;
1086 
1087  event = 0;
1088  for( i = 0; i < total_events; i++ ) {
1089 
1090  /* find the first event that isn't PAPI_NULL */
1091  /* Is this really necessary? --vmw */
1092  while ( ESI->EventInfoArray[event].event_code == ( unsigned int ) PAPI_NULL ) {
1093  event++;
1094  }
1095 
1096  /* If it's a preset */
1097  if ( IS_PRESET(ESI->EventInfoArray[event].event_code) ) {
1098  preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_PRESET_AND_MASK;
1099 
1100  /* walk all sub-events in the preset */
1101  for( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
1102  nevt = _papi_hwi_presets[preset_index].code[k];
1103  if ( nevt == PAPI_NULL ) {
1104  break;
1105  }
1106 
1107  INTDBG("Looking for subevent %#x\n",nevt);
1108 
1109  /* Match each sub-event to something in the Native List */
1110  for( n = 0; n < ESI->NativeCount; n++ ) {
1111  if ( nevt == ESI->NativeInfoArray[n].ni_papi_code ) {
1112  INTDBG("Found papi event: %#x, &ESI->NativeInfoArray[%d]: %p, ni_event: %#x, ni_position %d\n",
1113  nevt, n, &(ESI->NativeInfoArray[n]), ESI->NativeInfoArray[n].ni_event, ESI->NativeInfoArray[n].ni_position);
1114  ESI->EventInfoArray[event].pos[k] = ESI->NativeInfoArray[n].ni_position;
1115  break;
1116  }
1117  }
1118  }
1119  }
1120  /* If it's a native event */
1121  else if( IS_NATIVE(ESI->EventInfoArray[event].event_code) ) {
1122  nevt = ( int ) ESI->EventInfoArray[event].event_code;
1123 
1124  // get index into native info array for this event
1125  int nidx = event_already_in_eventset( ESI, nevt );
1126  // if not found, then we need to return an error
1127  if (nidx == PAPI_ENOEVNT) {
1128  INTDBG("EXIT: needed event not found\n");
1129  return;
1130  }
1131  ESI->EventInfoArray[event].pos[0] = ESI->NativeInfoArray[nidx].ni_position;
1132  INTDBG("nidx: %d, ni_position: %d\n", nidx, ESI->NativeInfoArray[nidx].ni_position);
1133 
1134  }
1135  /* If it's a user-defined event */
1136  else if ( IS_USER_DEFINED(ESI->EventInfoArray[event].event_code) ) {
1137  preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_UE_AND_MASK;
1138  for ( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
1139  nevt = user_defined_events[preset_index].code[k];
1140  INTDBG("nevt: %#x, user_defined_events[%d].code[%d]: %#x, code[%d]: %#x\n",
1141  nevt, preset_index, k, user_defined_events[preset_index].code[k], k+1, user_defined_events[preset_index].code[k+1]);
1142 
1143  if ( nevt == PAPI_NULL ) break;
1144 
1145  /* Match each sub-event to something in the Native List */
1146  for ( n = 0; n < ESI->NativeCount; n++ ) {
1147  // if this is the event we are looking for, set its position and exit inner loop to look for next sub-event
1148  if ( _papi_hwi_eventcode_to_native(nevt) == ESI->NativeInfoArray[n].ni_event ) {
1149  ESI->EventInfoArray[event].pos[k] = ESI->NativeInfoArray[n].ni_position;
1150  break;
1151  }
1152  }
1153  }
1154  }
1155  event++;
1156  }
1157  INTDBG("EXIT: \n");
1158  return;
1159 }
#define PAPI_ENOEVNT
Definition: papi.h:260
#define IS_PRESET(EventCode)
Definition: papi.h:229
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:230
#define PAPI_UE_AND_MASK
#define PAPI_NULL
Definition: papi.h:292
for(i=0;i<=max_y;i++)
Definition: iozone.c:11615
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static int event_already_in_eventset(EventSetInfo_t *ESI, int papi_event)
#define IS_NATIVE(EventCode)
Definition: papi.h:228
int k
Definition: iozone.c:19136
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
hwi_presets_t user_defined_events[PAPI_MAX_USER_EVENTS]
Definition: papi_internal.c:59
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
unsigned int event_code
#define PAPI_PRESET_AND_MASK
int _papi_hwi_eventcode_to_native(int event_code)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2508 of file papi_internal.c.

2510 {
2511  INTDBG("ENTER: EventCode: %#x, hwi_name: %p, len: %d\n", EventCode, hwi_name, len);
2512  int cidx;
2513  int retval;
2514  int nevt_code;
2515 
2516  cidx = _papi_hwi_component_index( EventCode );
2517  if (cidx<0) return PAPI_ENOEVNT;
2518 
2519  if ( EventCode & PAPI_NATIVE_MASK ) {
2520  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2521  _papi_hwi_set_papi_event_code(EventCode, 0);
2522 
2523  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2524  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2525  return nevt_code;
2526  }
2527  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2528  (unsigned int)nevt_code,
2529  hwi_name, len) ) == PAPI_OK ) {
2530  retval = _papi_hwi_prefix_component_name( _papi_hwd[cidx]->cmp_info.short_name,
2531  hwi_name, hwi_name, len);
2532  INTDBG("EXIT: retval: %d\n", retval);
2533  return retval;
2534  }
2535  INTDBG("EXIT: retval: %d\n", retval);
2536  return (retval);
2537  }
2538  INTDBG("EXIT: PAPI_ENOEVNT\n");
2539  return PAPI_ENOEVNT;
2540 }
#define PAPI_ENOEVNT
Definition: papi.h:260
#define PAPI_NATIVE_MASK
return PAPI_OK
Definition: linux-nvml.c:497
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int _papi_hwi_component_index(int event_code)
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
int _papi_hwi_eventcode_to_native(int event_code)
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_native_name_to_code ( const char *  in,
int out 
)

Definition at line 2415 of file papi_internal.c.

2416 {
2417  INTDBG("ENTER: in: %s, out: %p\n", in, out);
2418 
2419  int retval = PAPI_ENOEVNT;
2420  char name[PAPI_HUGE_STR_LEN]; /* make sure it's big enough */
2421  unsigned int i;
2422  int cidx;
2423  char *full_event_name;
2424 
2425  if (in == NULL) {
2426  INTDBG("EXIT: PAPI_EINVAL\n");
2427  return PAPI_EINVAL;
2428  }
2429 
2430  full_event_name = strdup(in);
2431 
2433 
2434  // look in each component
2435  for(cidx=0; cidx < papi_num_components; cidx++) {
2436 
2437  if (_papi_hwd[cidx]->cmp_info.disabled) continue;
2438 
2439  // if this component does not support the pmu which defines this event, no need to call it
2440  if (is_supported_by_component(cidx, full_event_name) == 0) continue;
2441 
2442  INTDBG("cidx: %d, name: %s, event: %s\n", cidx, _papi_hwd[cidx]->cmp_info.name, in);
2443 
2444  // show that we do not have an event code yet (the component may create one and update this info)
2445  // this also clears any values left over from a previous call
2447 
2448 
2449  // if component has a ntv_name_to_code function, use it to get event code
2450  if (_papi_hwd[cidx]->ntv_name_to_code != NULL) {
2451  // try and get this events event code
2452  retval = _papi_hwd[cidx]->ntv_name_to_code( in, ( unsigned * ) out );
2453  if (retval==PAPI_OK) {
2454  *out = _papi_hwi_native_to_eventcode(cidx, *out, -1, in);
2455  free (full_event_name);
2456  INTDBG("EXIT: PAPI_OK event: %s code: %#x\n", in, *out);
2457  return PAPI_OK;
2458  }
2459  } else {
2460  // force the code through the work around
2461  retval = PAPI_ECMP;
2462  }
2463 
2464  /* If not implemented, work around */
2465  if ( retval==PAPI_ECMP) {
2466  i = 0;
2467  retval = _papi_hwd[cidx]->ntv_enum_events( &i, PAPI_ENUM_FIRST );
2468  if (retval != PAPI_OK) {
2469  free (full_event_name);
2470  INTDBG("EXIT: retval: %d\n", retval);
2471  return retval;
2472  }
2473 
2474 // _papi_hwi_lock( INTERNAL_LOCK );
2475 
2476  do {
2477  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2479  retval = _papi_hwd[cidx]->ntv_code_to_name(i, name, sizeof(name));
2480  /* printf("%#x\nname =|%s|\ninput=|%s|\n", i, name, in); */
2481  if ( retval == PAPI_OK && in != NULL) {
2482  if ( strcasecmp( name, in ) == 0 ) {
2483  *out = _papi_hwi_native_to_eventcode(cidx, i, -1, name);
2484  free (full_event_name);
2485  INTDBG("EXIT: PAPI_OK, event: %s, code: %#x\n", in, *out);
2486  return PAPI_OK;
2487  }
2488  retval = PAPI_ENOEVNT;
2489  } else {
2490  *out = 0;
2491  retval = PAPI_ENOEVNT;
2492  break;
2493  }
2494  } while ( ( _papi_hwd[cidx]->ntv_enum_events( &i, PAPI_ENUM_EVENTS ) == PAPI_OK ) );
2495 
2496 // _papi_hwi_unlock( INTERNAL_LOCK );
2497  }
2498  }
2499 
2500  free (full_event_name);
2501  INTDBG("EXIT: retval: %d\n", retval);
2502  return retval;
2503 }
#define PAPI_ENOEVNT
Definition: papi.h:260
static int is_supported_by_component(int cidx, char *event_name)
int(* ntv_code_to_name)(unsigned int, char *, int)
Definition: papi_vector.h:45
int(* ntv_name_to_code)(const char *, unsigned int *)
Definition: papi_vector.h:44
return PAPI_OK
Definition: linux-nvml.c:497
return PAPI_EINVAL
Definition: linux-nvml.c:436
papi_vector_t * _papi_hwd[]
#define PAPI_HUGE_STR_LEN
Definition: papi.h:467
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
int i
Definition: fileop.c:140
int _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char *event_name)
free(dummyfile[xx])
#define PAPI_ECMP
Definition: papi.h:256
goto out
Definition: pscanf.h:20
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int papi_num_components
int(* ntv_enum_events)(unsigned int *, int)
Definition: papi_vector.h:43
char * name
Definition: iozone.c:23648
ssize_t retval
Definition: libasync.c:338
const char * _papi_hwi_strip_component_prefix(const char *event_name)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 553 of file papi_internal.c.

553  {
554  INTDBG("Entry: cidx: %d, event: %#x, ntv_idx: %d, event_name: %s\n", cidx, event_code, ntv_idx, event_name);
555 
556  int result;
557 
558  if (papi_event_code_changed > 0) {
560  INTDBG("EXIT: papi_event_code: %#x set by the component\n", result);
561  return result;
562  }
563 
564  result=_papi_hwi_find_native_event(cidx, event_code, event_name);
565  if (result==PAPI_ENOEVNT) {
566  // Need to create one
567  result=_papi_hwi_add_native_event(cidx, event_code, ntv_idx, event_name);
568  }
569 
570  INTDBG("EXIT: result: %#x\n", result);
571  return result;
572 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:29
#define PAPI_ENOEVNT
Definition: papi.h:260
unsigned int _papi_hwi_get_papi_event_code()
static int _papi_hwi_find_native_event(int cidx, int event, const char *event_name)
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
static int _papi_hwi_add_native_event(int cidx, int ntv_event, int ntv_idx, const char *event_name)
static int papi_event_code_changed

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_query_native_event ( unsigned int  EventCode)

Definition at line 2384 of file papi_internal.c.

2385 {
2386  INTDBG("ENTER: EventCode: %#x\n", EventCode);
2387  char name[PAPI_HUGE_STR_LEN]; /* probably overkill, */
2388  /* but should always be big enough */
2389  int cidx;
2390  int nevt_code;
2391 
2392  cidx = _papi_hwi_component_index( EventCode );
2393  if (cidx<0) {
2394  INTDBG("EXIT: PAPI_ENOCMP\n");
2395  return PAPI_ENOCMP;
2396  }
2397 
2398  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2399  _papi_hwi_set_papi_event_code(EventCode, 0);
2400 
2401  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2402  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2403  return nevt_code;
2404  }
2405  int ret = _papi_hwd[cidx]->ntv_code_to_name( (unsigned int)nevt_code, name, sizeof(name));
2406 
2407  INTDBG("EXIT: ret: %d\n", ret);
2408  return (ret);
2409 }
int(* ntv_code_to_name)(unsigned int, char *, int)
Definition: papi_vector.h:45
papi_vector_t * _papi_hwd[]
#define PAPI_HUGE_STR_LEN
Definition: papi.h:467
#define INTDBG(format, args...)
Definition: papi_debug.h:65
long long ret
Definition: iozone.c:1346
static int cidx
#define PAPI_ENOCMP
Definition: papi.h:270
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
char * name
Definition: iozone.c:23648
int _papi_hwi_component_index(int event_code)
int _papi_hwi_eventcode_to_native(int event_code)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1691 of file papi_internal.c.

1693 {
1694  INTDBG("ENTER: context: %p, ESI: %p, values: %p\n", context, ESI, values);
1695  int retval;
1696  long long *dp = NULL;
1697  int i, index;
1698 
1699  retval = _papi_hwd[ESI->CmpIdx]->read( context, ESI->ctl_state,
1700  &dp, ESI->state );
1701  if ( retval != PAPI_OK ) {
1702  INTDBG("EXIT: retval: %d\n", retval);
1703  return retval;
1704  }
1705 
1706  /* This routine distributes hardware counters to software counters in the
1707  order that they were added. Note that the higher level
1708  EventInfoArray[i] entries may not be contiguous because the user
1709  has the right to remove an event.
1710  But if we do compaction after remove event, this function can be
1711  changed.
1712  */
1713 
1714  for ( i = 0; i != ESI->NumberOfEvents; i++ ) {
1715 
1716  index = ESI->EventInfoArray[i].pos[0];
1717 
1718  if ( index == -1 )
1719  continue;
1720 
1721  INTDBG( "ESI->EventInfoArray: %p, pos[%d]: %d, dp[%d]: %lld, derived[%d]: %#x\n", ESI->EventInfoArray, i, index, index, dp[index], i, ESI->EventInfoArray[i].derived );
1722 
1723  /* If this is not a derived event */
1724 
1725  if ( ESI->EventInfoArray[i].derived == NOT_DERIVED ) {
1726  values[i] = dp[index];
1727  INTDBG( "value: %#llx\n", values[i] );
1728  } else { /* If this is a derived event */
1729  values[i] = handle_derived( &ESI->EventInfoArray[i], dp );
1730 #ifdef DEBUG
1731  if ( values[i] < ( long long ) 0 ) {
1732  INTDBG( "Derived Event is negative!!: %lld\n", values[i] );
1733  }
1734  INTDBG( "derived value: %#llx \n", values[i] );
1735 #endif
1736  }
1737  }
1738 
1739  INTDBG("EXIT: PAPI_OK\n");
1740  return PAPI_OK;
1741 }
int(* read)(hwd_context_t *, hwd_control_state_t *, long long **, int)
Definition: papi_vector.h:30
return PAPI_OK
Definition: linux-nvml.c:497
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
#define NOT_DERIVED
Definition: papi_internal.h:69
EventInfo_t * EventInfoArray
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
static long long handle_derived(EventInfo_t *evi, long long *from)
hwd_control_state_t * ctl_state
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1608 of file papi_internal.c.

1609 {
1610  int j = 0, retval, thisindex;
1611  EventInfo_t *array;
1612 
1613  thisindex =
1614  _papi_hwi_lookup_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1615  if ( thisindex < PAPI_OK )
1616  return ( thisindex );
1617 
1618  /* If it is a MPX EventSet, remove it from the multiplex data structure and
1619  this threads multiplex list */
1620 
1621  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1622  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1623  if ( retval < PAPI_OK )
1624  return ( retval );
1625  } else
1626  /* Remove the events hardware dependent stuff from the EventSet */
1627  {
1628  if ( IS_PRESET(EventCode) ) {
1629  int preset_index = EventCode & PAPI_PRESET_AND_MASK;
1630 
1631  /* Check if it's within the valid range */
1632  if ( ( preset_index < 0 ) ||
1633  ( preset_index >= PAPI_MAX_PRESET_EVENTS ) )
1634  return PAPI_EINVAL;
1635 
1636  /* Check if event exists */
1637  if ( !_papi_hwi_presets[preset_index].count )
1638  return PAPI_ENOEVNT;
1639 
1640  /* Remove the preset event. */
1641  for ( j = 0; _papi_hwi_presets[preset_index].code[j] != (unsigned int)PAPI_NULL;
1642  j++ );
1643  retval = remove_native_events( ESI, ( int * )_papi_hwi_presets[preset_index].code, j );
1644  if ( retval != PAPI_OK )
1645  return ( retval );
1646  } else if ( IS_NATIVE(EventCode) ) {
1647  /* Check if native event exists */
1648  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) !=
1649  PAPI_OK )
1650  return PAPI_ENOEVNT;
1651 
1652  /* Remove the native event. */
1653  retval = remove_native_events( ESI, &EventCode, 1 );
1654  if ( retval != PAPI_OK )
1655  return ( retval );
1656  } else if ( IS_USER_DEFINED( EventCode ) ) {
1657  int index = EventCode & PAPI_UE_AND_MASK;
1658 
1659  if ( (index < 0) || (index >= user_defined_events_count) )
1660  return ( PAPI_EINVAL );
1661 
1662  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT &&
1663  user_defined_events[index].code[j] != 0; j++ ) {
1664  retval = remove_native_events( ESI, ( int * )user_defined_events[index].code, j);
1665 
1666  if ( retval != PAPI_OK )
1667  return ( retval );
1668  }
1669  } else
1670  return ( PAPI_ENOEVNT );
1671  }
1672  array = ESI->EventInfoArray;
1673 
1674  /* Compact the Event Info Array list if it's not the last event */
1675  /* clear the newly empty slot in the array */
1676  for ( ; thisindex < ESI->NumberOfEvents - 1; thisindex++ )
1677  array[thisindex] = array[thisindex + 1];
1678 
1679 
1680  array[thisindex].event_code = ( unsigned int ) PAPI_NULL;
1681  for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ )
1682  array[thisindex].pos[j] = PAPI_NULL;
1683  array[thisindex].ops = NULL;
1684  array[thisindex].derived = NOT_DERIVED;
1685  ESI->NumberOfEvents--;
1686 
1687  return ( PAPI_OK );
1688 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_ENOEVNT
Definition: papi.h:260
#define IS_PRESET(EventCode)
Definition: papi.h:229
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:230
#define PAPI_UE_AND_MASK
int _papi_hwi_query_native_event(unsigned int EventCode)
#define PAPI_NULL
Definition: papi.h:292
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
#define PAPI_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:497
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:436
#define IS_NATIVE(EventCode)
Definition: papi.h:228
#define NOT_DERIVED
Definition: papi_internal.h:69
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
int user_defined_events_count
Definition: papi_internal.c:60
hwi_presets_t user_defined_events[PAPI_MAX_USER_EVENTS]
Definition: papi_internal.c:59
int _papi_hwi_lookup_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
EventInfo_t * EventInfoArray
static int remove_native_events(EventSetInfo_t *ESI, int *nevt, int size)
EventSetMultiplexInfo_t multiplex
int mpx_remove_event(MPX_EventSet **mpx_events, int EventCode)
Definition: sw_multiplex.c:418
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
unsigned int event_code
#define PAPI_PRESET_AND_MASK
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_EventSet ( EventSetInfo_t ESI)

Definition at line 1018 of file papi_internal.c.

1019 {
1021  int i;
1022 
1023  i = ESI->EventSetIndex;
1024 
1026 
1027  _papi_hwi_free_EventSet( ESI );
1028 
1029  /* do bookkeeping for PAPI_EVENTSET_MAP */
1030 
1031  map->dataSlotArray[i] = NULL;
1032  map->availSlots++;
1033  map->fullSlots--;
1034 
1036 
1037  return PAPI_OK;
1038 }
return PAPI_OK
Definition: linux-nvml.c:497
int i
Definition: fileop.c:140
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
DynamicArray_t global_eventset_map
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
EventSetInfo_t ** dataSlotArray
#define INTERNAL_LOCK
Definition: papi_internal.h:86
void _papi_hwi_free_EventSet(EventSetInfo_t *ESI)

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_set_papi_event_code ( unsigned int  event_code,
int  update_flag 
)

Definition at line 119 of file papi_internal.c.

119  {
120  INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
121 
122  // if call is just to reset and start over, set both flags to show nothing saved yet
123  if (update_flag < 0) {
125  papi_event_code = -1;
126  return;
127  }
128 
129  // if 0, it is being set prior to calling a component, if >0 it is being changed by the component
130  papi_event_code_changed = update_flag;
131  // save the event code passed in
132  papi_event_code = event_code;
133  return;
134 }
static unsigned int papi_event_code
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int papi_event_code_changed

Here is the caller graph for this function:

void _papi_hwi_set_papi_event_string ( const char *  event_string)

Definition at line 90 of file papi_internal.c.

90  {
91  INTDBG("event_string: %s\n", event_string);
92  if (papi_event_string != NULL) {
94  papi_event_string = NULL;
95  }
96  if (event_string != NULL) {
97  papi_event_string = strdup(event_string);
98  }
99  return;
100 }
char * papi_event_string
Definition: papi_internal.c:88
#define INTDBG(format, args...)
Definition: papi_debug.h:65
free(dummyfile[xx])

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_shutdown_global_internal ( void  )

Definition at line 1989 of file papi_internal.c.

1990 {
1992 
1994 
1996 
1999  0x00, sizeof ( DynamicArray_t ) );
2000 
2002 
2005  }
2006  memset( &_papi_hwi_system_info, 0x0, sizeof ( _papi_hwi_system_info ) );
2007 
2008 }
#define papi_free(a)
Definition: papi_memory.h:35
PAPI_shlib_info_t shlib_info
static void _papi_hwi_cleanup_errors()
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:64
DynamicArray_t global_eventset_map
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:78
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
again struct sockaddr sizeof(struct sockaddr_in))
EventSetInfo_t ** dataSlotArray
#define INTERNAL_LOCK
Definition: papi_internal.h:86
PAPI_address_map_t * map
Definition: papi.h:714
int _papi_hwi_cleanup_all_presets(void)
Definition: papi_preset.c:114

Here is the call graph for this function:

Here is the caller graph for this function:

void PAPIERROR ( char *  format,
  ... 
)

Definition at line 601 of file papi_internal.c.

602 {
603  va_list args;
604  if ( ( _papi_hwi_error_level != PAPI_QUIET ) ||
605  ( getenv( "PAPI_VERBOSE" ) ) ) {
606  va_start( args, format );
607  fprintf( stderr, "PAPI Error: " );
608  vfprintf( stderr, format, args );
609  fprintf( stderr, "\n" );
610  va_end( args );
611  }
612 }
char * getenv()
va_start(arg_list, fmt)
int _papi_hwi_error_level
Definition: papi_internal.c:54
va_end(arg_list)
#define PAPI_QUIET
Definition: papi.h:388

Here is the call graph for this function:

void PAPIWARN ( char *  format,
  ... 
)

Definition at line 615 of file papi_internal.c.

616 {
617  va_list args;
618  if ( ( _papi_hwi_error_level != PAPI_QUIET ) ||
619  ( getenv( "PAPI_VERBOSE" ) ) ) {
620  va_start( args, format );
621  fprintf( stderr, "PAPI Warning: " );
622  vfprintf( stderr, format, args );
623  fprintf( stderr, "\n" );
624  va_end( args );
625  }
626 }
char * getenv()
va_start(arg_list, fmt)
int _papi_hwi_error_level
Definition: papi_internal.c:54
va_end(arg_list)
#define PAPI_QUIET
Definition: papi.h:388

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

char** _papi_errlist

Definition at line 81 of file papi_internal.c.

PAPI_debug_handler_t _papi_hwi_debug_handler

Definition at line 55 of file papi_internal.c.

int _papi_hwi_errno

Definition at line 57 of file papi_internal.c.

int _papi_hwi_error_level

Definition at line 451 of file papi_internal.h.

int _papi_hwi_num_errors

Definition at line 58 of file papi_internal.c.

papi_mdi_t _papi_hwi_system_info

Definition at line 56 of file papi_internal.c.

int _papi_hwi_using_signal[PAPI_NSIG]

Definition at line 365 of file extras.c.

int _papi_num_compiled_components
PAPI_os_info_t _papi_os_info

Definition at line 1210 of file aix.c.

int init_level

Definition at line 53 of file papi_internal.c.

int papi_num_components

Definition at line 1914 of file papi_internal.c.