PAPI  5.4.1.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,...)
 
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 (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 1315 of file papi_internal.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_cleanup_eventset ( EventSetInfo_t ESI)

Definition at line 1729 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_component_index ( int  event_code)

Definition at line 514 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_convert_eventset_to_multiplex ( _papi_int_multiplex_t mpx)

Definition at line 1841 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_create_eventset ( int EventSet,
ThreadInfo_t handle 
)

Definition at line 917 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_derived_type ( char *  tmp,
int code 
)

Definition at line 2204 of file papi_internal.c.

2205 {
2206  int i = 0;
2207  while ( _papi_hwi_derived[i].name != NULL ) {
2208  if ( strcasecmp( tmp, _papi_hwi_derived[i].name ) == 0 ) {
2209  *code = _papi_hwi_derived[i].value;
2210  return PAPI_OK;
2211  }
2212  i++;
2213  }
2214  INTDBG( "Invalid derived string %s\n", tmp );
2215  return PAPI_EINVAL;
2216 }
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static const hwi_describe_t _papi_hwi_derived[]
char * name
Definition: iozone.c:23648
long long tmp
Definition: iozone.c:12031

Here is the caller graph for this function:

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

Definition at line 1995 of file papi_internal.c.

1997 {
1998  /* This function is not used and shouldn't be called. */
1999  ( void ) EventSet; /*unused */
2000  ( void ) address; /*unused */
2001  ( void ) overflow_vector; /*unused */
2002  ( void ) context; /*unused */
2003  return;
2004 }
int EventSet
Definition: data_range.c:25
void
Definition: iozone.c:18627

Here is the caller graph for this function:

int _papi_hwi_eventcode_to_native ( int  event_code)

Definition at line 575 of file papi_internal.c.

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

Here is the caller graph for this function:

void _papi_hwi_free_EventSet ( EventSetInfo_t ESI)

Definition at line 872 of file papi_internal.c.

873 {
875 
876 #ifdef DEBUG
877  memset( ESI, 0x00, sizeof ( EventSetInfo_t ) );
878 #endif
879  papi_free( ESI );
880 
881 }
#define papi_free(a)
Definition: papi_memory.h:35
int _papi_hwi_cleanup_eventset(EventSetInfo_t *ESI)

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_free_papi_event_string ( )

Definition at line 106 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

hwd_context_t* _papi_hwi_get_context ( EventSetInfo_t ESI,
int is_dirty 
)

Definition at line 2648 of file papi_internal.c.

2649 {
2650  INTDBG("Entry: ESI: %p, is_dirty: %p\n", ESI, is_dirty);
2651  int dirty_ctx;
2652  hwd_context_t *ctx=NULL;
2653 
2654  /* assume for now the control state is clean (last updated by this ESI) */
2655  dirty_ctx = 0;
2656 
2657  /* get a context pointer based on if we are counting for a thread or for a cpu */
2658  if (ESI->state & PAPI_CPU_ATTACHED) {
2659  /* use cpu context */
2660  ctx = ESI->CpuInfo->context[ESI->CmpIdx];
2661 
2662  /* if the user wants to know if the control state was last set by the same event set, tell him */
2663  if (is_dirty != NULL) {
2664  if (ESI->CpuInfo->from_esi != ESI) {
2665  dirty_ctx = 1;
2666  }
2667  *is_dirty = dirty_ctx;
2668  }
2669  ESI->CpuInfo->from_esi = ESI;
2670 
2671  } else {
2672 
2673  /* use thread context */
2674  ctx = ESI->master->context[ESI->CmpIdx];
2675 
2676  /* if the user wants to know if the control state was last set by the same event set, tell him */
2677  if (is_dirty != NULL) {
2678  if (ESI->master->from_esi != ESI) {
2679  dirty_ctx = 1;
2680  }
2681  *is_dirty = dirty_ctx;
2682  }
2683  ESI->master->from_esi = ESI;
2684 
2685  }
2686  return( ctx );
2687 }
#define PAPI_CPU_ATTACHED
Definition: papi.h:380
#define INTDBG(format, args...)
Definition: papi_debug.h:65
struct _CpuInfo * CpuInfo
struct _ThreadInfo * master

Here is the caller graph for this function:

int _papi_hwi_get_native_event_info ( unsigned int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2531 of file papi_internal.c.

2533 {
2534  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2535  int retval;
2536  int cidx;
2537  int nevt_code;
2538 
2539  cidx = _papi_hwi_component_index( EventCode );
2540  if (cidx<0) return PAPI_ENOCMP;
2541 
2542  if (_papi_hwd[cidx]->cmp_info.disabled) return PAPI_ENOCMP;
2543 
2544  if ( EventCode & PAPI_NATIVE_MASK ) {
2545  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2546  _papi_hwi_set_papi_event_code(EventCode, 0);
2547 
2548  /* clear the event info */
2549  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2550  info->event_code = ( unsigned int ) EventCode;
2551 
2552  retval = _papi_hwd[cidx]->ntv_code_to_info(
2553  _papi_hwi_eventcode_to_native(EventCode), info);
2554 
2555  /* If component error, it's missing the ntv_code_to_info vector */
2556  /* so we'll have to fake it. */
2557  if ( retval == PAPI_ECMP ) {
2558 
2559 
2560  INTDBG("missing NTV_CODE_TO_INFO, faking\n");
2561  /* Fill in the info structure */
2562 
2563  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2564  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2565  return nevt_code;
2566  }
2567  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2568  (unsigned int)nevt_code,
2569  info->symbol,
2570  sizeof(info->symbol)) ) == PAPI_OK ) {
2571 
2572  } else {
2573  INTDBG("EXIT: retval: %d\n", retval);
2574  return retval;
2575  }
2576 
2577  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) <0) {
2578  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2579  return nevt_code;
2580  }
2581  retval = _papi_hwd[cidx]->ntv_code_to_descr(
2582  (unsigned int)nevt_code,
2583  info->long_descr,
2584  sizeof ( info->long_descr));
2585  if (retval!=PAPI_OK) {
2586  INTDBG("Failed ntv_code_to_descr()\n");
2587  }
2588 
2589  }
2591  _papi_hwd[cidx]->cmp_info.short_name,
2592  info->symbol,
2593  info->symbol,
2594  sizeof(info->symbol) );
2595 
2596  INTDBG("EXIT: retval: %d\n", retval);
2597  return retval;
2598  }
2599 
2600  INTDBG("EXIT: PAPI_ENOEVNT\n");
2601  return PAPI_ENOEVNT;
2602 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_NATIVE_MASK
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
return PAPI_OK
Definition: linux-nvml.c:458
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
Definition: event_info.c:40
int(* ntv_code_to_info)(unsigned int, PAPI_event_info_t *)
Definition: papi_vector.h:48
#define PAPI_ECMP
Definition: papi.h:254
again struct sockaddr sizeof(struct sockaddr_in))
#define PAPI_ENOCMP
Definition: papi.h:268
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int
Definition: iozone.c:18528
int _papi_hwi_component_index(int event_code)
int(* ntv_code_to_descr)(unsigned int, char *, int)
Definition: papi_vector.h:46
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
int _papi_hwi_eventcode_to_native(int event_code)
unsigned int event_code
Definition: papi.h:961
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_ntv_idx ( unsigned int  papi_evt_code)

Definition at line 141 of file papi_internal.c.

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

Here is the caller graph for this function:

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

Definition at line 135 of file papi_internal.c.

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

Here is the caller graph for this function:

char* _papi_hwi_get_papi_event_string ( void  )

Definition at line 101 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_get_preset_event_info ( int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2248 of file papi_internal.c.

2249 {
2250  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2251 
2252  int i = EventCode & PAPI_PRESET_AND_MASK;
2253  unsigned int j;
2254 
2255  if ( _papi_hwi_presets[i].symbol ) { /* if the event is in the preset table */
2256  // since we are setting the whole structure to zero the strncpy calls below will
2257  // be leaving NULL terminates strings as long as they copy 1 less byte than the
2258  // buffer size of the field.
2259  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2260 
2261  info->event_code = ( unsigned int ) EventCode;
2262  strncpy( info->symbol, _papi_hwi_presets[i].symbol,
2263  sizeof(info->symbol)-1);
2264 
2265  if ( _papi_hwi_presets[i].short_descr != NULL )
2266  strncpy( info->short_descr, _papi_hwi_presets[i].short_descr,
2267  sizeof ( info->short_descr )-1 );
2268 
2269  if ( _papi_hwi_presets[i].long_descr != NULL )
2270  strncpy( info->long_descr, _papi_hwi_presets[i].long_descr,
2271  sizeof ( info->long_descr )-1 );
2272 
2274  info->count = _papi_hwi_presets[i].count;
2275 
2277  info->derived, sizeof ( info->derived ) );
2278 
2279  if ( _papi_hwi_presets[i].postfix != NULL )
2280  strncpy( info->postfix, _papi_hwi_presets[i].postfix,
2281  sizeof ( info->postfix )-1 );
2282 
2283  for(j=0;j < info->count; j++) {
2284  info->code[j]=_papi_hwi_presets[i].code[j];
2285  strncpy(info->name[j], _papi_hwi_presets[i].name[j],
2286  sizeof(info->name[j])-1);
2287  }
2288 
2289  if ( _papi_hwi_presets[i].note != NULL ) {
2290  strncpy( info->note, _papi_hwi_presets[i].note,
2291  sizeof ( info->note )-1 );
2292  }
2293 
2294  return PAPI_OK;
2295  } else {
2296  return PAPI_ENOEVNT;
2297  }
2298 }
#define PAPI_ENOEVNT
Definition: papi.h:258
unsigned int count
Definition: papi.h:984
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
static int _papi_hwi_derived_string(int type, char *derived, int len)
return PAPI_OK
Definition: linux-nvml.c:458
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1010
#define INTDBG(format, args...)
Definition: papi_debug.h:65
unsigned int event_type
Definition: papi_preset.h:30
int i
Definition: fileop.c:140
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:964
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
unsigned int event_type
Definition: papi.h:989
char * short_descr
Definition: papi_preset.h:25
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi.h:1000
again struct sockaddr sizeof(struct sockaddr_in))
char * long_descr
Definition: papi_preset.h:26
int
Definition: iozone.c:18528
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
char * name[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:33
#define PAPI_PRESET_AND_MASK
long j
Definition: iozone.c:19135
unsigned int event_code
Definition: papi.h:961
char * symbol
Definition: papi_preset.h:24
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:992
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:995
unsigned int count
Definition: papi_preset.h:29
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1006
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_user_event_info ( int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2308 of file papi_internal.c.

2309 {
2310  INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
2311 
2312  unsigned int i = EventCode & PAPI_UE_AND_MASK;
2313  unsigned int j;
2314 
2315  // if event code not in valid range, return error
2316  if (i >= PAPI_MAX_USER_EVENTS) {
2317  INTDBG("EXIT: Invalid event index: %d, max value is: %d\n", i, PAPI_MAX_USER_EVENTS - 1);
2318  return( PAPI_ENOEVNT );
2319  }
2320 
2321  if ( user_defined_events[i].symbol == NULL) { /* if the event is in the preset table */
2322  INTDBG("EXIT: Event symbol for this event is NULL\n");
2323  return PAPI_ENOEVNT;
2324  }
2325 
2326  /* set whole structure to 0 */
2327  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2328 
2329  info->event_code = ( unsigned int ) EventCode;
2330  strncpy( info->symbol, user_defined_events[i].symbol,
2331  sizeof(info->symbol)-1);
2332 
2333  if ( user_defined_events[i].short_descr != NULL )
2334  strncpy( info->short_descr, user_defined_events[i].short_descr,
2335  sizeof(info->short_descr)-1);
2336 
2337  if ( user_defined_events[i].long_descr != NULL )
2338  strncpy( info->long_descr, user_defined_events[i].long_descr,
2339  sizeof(info->long_descr)-1);
2340 
2341 // info->event_type = user_defined_events[i].event_type;
2342  info->count = user_defined_events[i].count;
2343 
2345  info->derived, sizeof(info->derived)-1);
2346 
2347  if ( user_defined_events[i].postfix != NULL )
2348  strncpy( info->postfix, user_defined_events[i].postfix,
2349  sizeof(info->postfix)-1);
2350 
2351  for(j=0;j < info->count; j++) {
2352  info->code[j]=user_defined_events[i].code[j];
2353  INTDBG("info->code[%d]: %#x\n", j, info->code[j]);
2354  strncpy(info->name[j], user_defined_events[i].name[j], sizeof(info->name[j])-1);
2355  }
2356 
2357  if ( user_defined_events[i].note != NULL ) {
2358  strncpy( info->note, user_defined_events[i].note, sizeof(info->note)-1);
2359  }
2360 
2361  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);
2362  return PAPI_OK;
2363 }
#define PAPI_ENOEVNT
Definition: papi.h:258
unsigned int count
Definition: papi.h:984
#define PAPI_UE_AND_MASK
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
static int _papi_hwi_derived_string(int type, char *derived, int len)
return PAPI_OK
Definition: linux-nvml.c:458
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1010
#define INTDBG(format, args...)
Definition: papi_debug.h:65
#define PAPI_MAX_USER_EVENTS
int i
Definition: fileop.c:140
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:964
hwi_presets_t user_defined_events[PAPI_MAX_USER_EVENTS]
Definition: papi_internal.c:58
char * short_descr
Definition: papi_preset.h:25
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi.h:1000
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:961
char * symbol
Definition: papi_preset.h:24
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:992
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:995
unsigned int count
Definition: papi_preset.h:29
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1006
char * postfix
Definition: papi_preset.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_init_errors ( void  )

Definition at line 477 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global ( void  )

Definition at line 1907 of file papi_internal.c.

1908 {
1909  int retval, i = 0;
1910 
1912  if ( retval != PAPI_OK ) {
1913  return retval;
1914  }
1915 
1916  while ( _papi_hwd[i] ) {
1917 
1918  retval = _papi_hwi_innoculate_vector( _papi_hwd[i] );
1919  if ( retval != PAPI_OK ) {
1920  return retval;
1921  }
1922 
1923  /* We can be disabled by user before init */
1924  if (!_papi_hwd[i]->cmp_info.disabled) {
1925  retval = _papi_hwd[i]->init_component( i );
1927 
1928  /* Do some sanity checking */
1929  if (retval==PAPI_OK) {
1930  if (_papi_hwd[i]->cmp_info.num_cntrs >
1932  fprintf(stderr,"Warning! num_cntrs is more than num_mpx_cntrs\n");
1933  }
1934 
1935  }
1936  }
1937 
1938  i++;
1939  }
1940  return PAPI_OK;
1941 }
int _papi_hwi_innoculate_os_vector(papi_os_vector_t *v)
Definition: papi_vector.c:200
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
int i
Definition: fileop.c:140
int _papi_hwi_innoculate_vector(papi_vector_t *v)
Definition: papi_vector.c:109
ssize_t retval
Definition: libasync.c:338
int(* init_component)(int)
Definition: papi_vector.h:35

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global_internal ( void  )

Definition at line 1947 of file papi_internal.c.

1948 {
1949 
1950  int retval;
1951 
1952  memset(&_papi_hwi_system_info,0x0,sizeof( _papi_hwi_system_info ));
1953 
1954  memset( _papi_hwi_using_signal,0x0,sizeof( _papi_hwi_using_signal ));
1955 
1956  /* Global struct to maintain EventSet mapping */
1958  if ( retval != PAPI_OK ) {
1959  return retval;
1960  }
1961 
1962  _papi_hwi_system_info.pid = 0; /* Process identifier */
1963 
1964  /* PAPI_hw_info_t struct */
1965  memset(&(_papi_hwi_system_info.hw_info),0x0,sizeof(PAPI_hw_info_t));
1966 
1967  return PAPI_OK;
1968 }
int _papi_hwi_using_signal[PAPI_NSIG]
Definition: extras.c:363
Hardware info structure.
Definition: papi.h:777
return PAPI_OK
Definition: linux-nvml.c:458
DynamicArray_t global_eventset_map
static int allocate_eventset_map(DynamicArray_t *map)
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:55
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:458
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:463

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_invalid_cmp ( int  cidx)

Definition at line 507 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_is_sw_multiplex ( EventSetInfo_t ESI)

Definition at line 2624 of file papi_internal.c.

2625 {
2626  /* Are we multiplexing at all */
2627  if ( ( ESI->state & PAPI_MULTIPLEXING ) == 0 ) {
2628  return 0;
2629  }
2630 
2631  /* Does the component support kernel multiplexing */
2632  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) {
2633  /* Have we forced software multiplexing */
2634  if ( ESI->multiplex.flags == PAPI_MULTIPLEX_FORCE_SW ) {
2635  return 1;
2636  }
2637  /* Nope, using hardware multiplexing */
2638  return 0;
2639  }
2640 
2641  /* We are multiplexing but the component does not support hardware */
2642 
2643  return 1;
2644 
2645 }
#define PAPI_MULTIPLEXING
Definition: papi.h:378
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:417
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
unsigned int kernel_multiplex
Definition: papi.h:653
EventSetMultiplexInfo_t multiplex

Here is the caller graph for this function:

int _papi_hwi_lookup_EventCodeIndex ( const EventSetInfo_t ESI,
unsigned int  EventCode 
)

Definition at line 985 of file papi_internal.c.

987 {
988  int i;
989  int limit = EventInfoArrayLength( ESI );
990 
991  for ( i = 0; i < limit; i++ ) {
992  if ( ESI->EventInfoArray[i].event_code == EventCode ) {
993  return i;
994  }
995  }
996 
997  return PAPI_EINVAL;
998 }
static int EventInfoArrayLength(const EventSetInfo_t *ESI)
return PAPI_EINVAL
Definition: linux-nvml.c:408
int i
Definition: fileop.c:140
EventInfo_t * EventInfoArray
unsigned int event_code

Here is the call graph for this function:

Here is the caller graph for this function:

EventSetInfo_t* _papi_hwi_lookup_EventSet ( int  eventset)

Definition at line 2605 of file papi_internal.c.

2606 {
2608  EventSetInfo_t *set;
2609 
2610  if ( ( eventset < 0 ) || ( eventset > map->totalSlots ) )
2611  return ( NULL );
2612 
2613  set = map->dataSlotArray[eventset];
2614 #ifdef DEBUG
2615  if ( ( ISLEVEL( DEBUG_THREADS ) ) && ( _papi_hwi_thread_id_fn ) &&
2616  ( set->master->tid != _papi_hwi_thread_id_fn( ) ) )
2617  return ( NULL );
2618 #endif
2619 
2620  return ( set );
2621 }
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:55
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 1065 of file papi_internal.c.

1066 {
1067  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);
1068 
1069  int i, event, k, n, preset_index = 0, nevt;
1070  int total_events = ESI->NumberOfEvents;
1071 
1072  event = 0;
1073  for( i = 0; i < total_events; i++ ) {
1074 
1075  /* find the first event that isn't PAPI_NULL */
1076  /* Is this really necessary? --vmw */
1077  while ( ESI->EventInfoArray[event].event_code == ( unsigned int ) PAPI_NULL ) {
1078  event++;
1079  }
1080 
1081  /* If it's a preset */
1082  if ( IS_PRESET(ESI->EventInfoArray[event].event_code) ) {
1083  preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_PRESET_AND_MASK;
1084 
1085  /* walk all sub-events in the preset */
1086  for( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
1087  nevt = _papi_hwi_presets[preset_index].code[k];
1088  if ( nevt == PAPI_NULL ) {
1089  break;
1090  }
1091 
1092  INTDBG("Looking for subevent %#x\n",nevt);
1093 
1094  /* Match each sub-event to something in the Native List */
1095  for( n = 0; n < ESI->NativeCount; n++ ) {
1096  if ( nevt == ESI->NativeInfoArray[n].ni_papi_code ) {
1097  INTDBG("Found papi event: %#x, &ESI->NativeInfoArray[%d]: %p, ni_event: %#x, ni_position %d\n",
1098  nevt, n, &(ESI->NativeInfoArray[n]), ESI->NativeInfoArray[n].ni_event, ESI->NativeInfoArray[n].ni_position);
1099  ESI->EventInfoArray[event].pos[k] = ESI->NativeInfoArray[n].ni_position;
1100  break;
1101  }
1102  }
1103  }
1104  }
1105  /* If it's a native event */
1106  else if( IS_NATIVE(ESI->EventInfoArray[event].event_code) ) {
1107  nevt = ( int ) ESI->EventInfoArray[event].event_code;
1108 
1109  // get index into native info array for this event
1110  int nidx = event_already_in_eventset( ESI, nevt );
1111  // if not found, then we need to return an error
1112  if (nidx == PAPI_ENOEVNT) {
1113  INTDBG("EXIT: needed event not found\n");
1114  return;
1115  }
1116  ESI->EventInfoArray[event].pos[0] = ESI->NativeInfoArray[nidx].ni_position;
1117  INTDBG("nidx: %d, ni_position: %d\n", nidx, ESI->NativeInfoArray[nidx].ni_position);
1118 
1119  }
1120  /* If it's a user-defined event */
1121  else if ( IS_USER_DEFINED(ESI->EventInfoArray[event].event_code) ) {
1122  preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_UE_AND_MASK;
1123  for ( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
1124  nevt = user_defined_events[preset_index].code[k];
1125  INTDBG("nevt: %#x, user_defined_events[%d].code[%d]: %#x, code[%d]: %#x\n",
1126  nevt, preset_index, k, user_defined_events[preset_index].code[k], k+1, user_defined_events[preset_index].code[k+1]);
1127 
1128  if ( nevt == PAPI_NULL ) break;
1129 
1130  /* Match each sub-event to something in the Native List */
1131  for ( n = 0; n < ESI->NativeCount; n++ ) {
1132  // if this is the event we are looking for, set its position and exit inner loop to look for next sub-event
1133  if ( _papi_hwi_eventcode_to_native(nevt) == ESI->NativeInfoArray[n].ni_event ) {
1134  ESI->EventInfoArray[event].pos[k] = ESI->NativeInfoArray[n].ni_position;
1135  break;
1136  }
1137  }
1138  }
1139  }
1140  event++;
1141  }
1142  INTDBG("EXIT: \n");
1143  return;
1144 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define PAPI_UE_AND_MASK
#define PAPI_NULL
Definition: papi.h:290
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:226
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:58
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)
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2493 of file papi_internal.c.

2495 {
2496  INTDBG("ENTER: EventCode: %#x, hwi_name: %p, len: %d\n", EventCode, hwi_name, len);
2497  int cidx;
2498  int retval;
2499  int nevt_code;
2500 
2501  cidx = _papi_hwi_component_index( EventCode );
2502  if (cidx<0) return PAPI_ENOEVNT;
2503 
2504  if ( EventCode & PAPI_NATIVE_MASK ) {
2505  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2506  _papi_hwi_set_papi_event_code(EventCode, 0);
2507 
2508  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2509  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2510  return nevt_code;
2511  }
2512  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2513  (unsigned int)nevt_code,
2514  hwi_name, len) ) == PAPI_OK ) {
2515  retval = _papi_hwi_prefix_component_name( _papi_hwd[cidx]->cmp_info.short_name,
2516  hwi_name, hwi_name, len);
2517  INTDBG("EXIT: retval: %d\n", retval);
2518  return retval;
2519  }
2520  INTDBG("EXIT: retval: %d\n", retval);
2521  return (retval);
2522  }
2523  INTDBG("EXIT: PAPI_ENOEVNT\n");
2524  return PAPI_ENOEVNT;
2525 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_NATIVE_MASK
return PAPI_OK
Definition: linux-nvml.c:458
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
static int cidx
Definition: event_info.c:40
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
int _papi_hwi_component_index(int event_code)
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
int _papi_hwi_eventcode_to_native(int event_code)
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_native_name_to_code ( char *  in,
int out 
)

Definition at line 2400 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 552 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_query_native_event ( unsigned int  EventCode)

Definition at line 2369 of file papi_internal.c.

2370 {
2371  INTDBG("ENTER: EventCode: %#x\n", EventCode);
2372  char name[PAPI_HUGE_STR_LEN]; /* probably overkill, */
2373  /* but should always be big enough */
2374  int cidx;
2375  int nevt_code;
2376 
2377  cidx = _papi_hwi_component_index( EventCode );
2378  if (cidx<0) {
2379  INTDBG("EXIT: PAPI_ENOCMP\n");
2380  return PAPI_ENOCMP;
2381  }
2382 
2383  // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
2384  _papi_hwi_set_papi_event_code(EventCode, 0);
2385 
2386  if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
2387  INTDBG("EXIT: nevt_code: %d\n", nevt_code);
2388  return nevt_code;
2389  }
2390  int ret = _papi_hwd[cidx]->ntv_code_to_name( (unsigned int)nevt_code, name, sizeof(name));
2391 
2392  INTDBG("EXIT: ret: %d\n", ret);
2393  return (ret);
2394 }
int(* ntv_code_to_name)(unsigned int, char *, int)
Definition: papi_vector.h:45
papi_vector_t * _papi_hwd[]
#define PAPI_HUGE_STR_LEN
Definition: papi.h:465
#define INTDBG(format, args...)
Definition: papi_debug.h:65
long long ret
Definition: iozone.c:1346
static int cidx
Definition: event_info.c:40
#define PAPI_ENOCMP
Definition: papi.h:268
void _papi_hwi_set_papi_event_code(unsigned int event_code, int update_flag)
char * name
Definition: iozone.c:23648
int _papi_hwi_component_index(int event_code)
int _papi_hwi_eventcode_to_native(int event_code)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1676 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1593 of file papi_internal.c.

1594 {
1595  int j = 0, retval, thisindex;
1596  EventInfo_t *array;
1597 
1598  thisindex =
1599  _papi_hwi_lookup_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1600  if ( thisindex < PAPI_OK )
1601  return ( thisindex );
1602 
1603  /* If it is a MPX EventSet, remove it from the multiplex data structure and
1604  this threads multiplex list */
1605 
1606  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1607  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1608  if ( retval < PAPI_OK )
1609  return ( retval );
1610  } else
1611  /* Remove the events hardware dependent stuff from the EventSet */
1612  {
1613  if ( IS_PRESET(EventCode) ) {
1614  int preset_index = EventCode & PAPI_PRESET_AND_MASK;
1615 
1616  /* Check if it's within the valid range */
1617  if ( ( preset_index < 0 ) ||
1618  ( preset_index >= PAPI_MAX_PRESET_EVENTS ) )
1619  return PAPI_EINVAL;
1620 
1621  /* Check if event exists */
1622  if ( !_papi_hwi_presets[preset_index].count )
1623  return PAPI_ENOEVNT;
1624 
1625  /* Remove the preset event. */
1626  for ( j = 0; _papi_hwi_presets[preset_index].code[j] != (unsigned int)PAPI_NULL;
1627  j++ );
1628  retval = remove_native_events( ESI, ( int * )_papi_hwi_presets[preset_index].code, j );
1629  if ( retval != PAPI_OK )
1630  return ( retval );
1631  } else if ( IS_NATIVE(EventCode) ) {
1632  /* Check if native event exists */
1633  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) !=
1634  PAPI_OK )
1635  return PAPI_ENOEVNT;
1636 
1637  /* Remove the native event. */
1638  retval = remove_native_events( ESI, &EventCode, 1 );
1639  if ( retval != PAPI_OK )
1640  return ( retval );
1641  } else if ( IS_USER_DEFINED( EventCode ) ) {
1642  int index = EventCode & PAPI_UE_AND_MASK;
1643 
1644  if ( (index < 0) || (index >= user_defined_events_count) )
1645  return ( PAPI_EINVAL );
1646 
1647  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT &&
1648  user_defined_events[index].code[j] != 0; j++ ) {
1649  retval = remove_native_events( ESI, ( int * )user_defined_events[index].code, j);
1650 
1651  if ( retval != PAPI_OK )
1652  return ( retval );
1653  }
1654  } else
1655  return ( PAPI_ENOEVNT );
1656  }
1657  array = ESI->EventInfoArray;
1658 
1659  /* Compact the Event Info Array list if it's not the last event */
1660  /* clear the newly empty slot in the array */
1661  for ( ; thisindex < ESI->NumberOfEvents - 1; thisindex++ )
1662  array[thisindex] = array[thisindex + 1];
1663 
1664 
1665  array[thisindex].event_code = ( unsigned int ) PAPI_NULL;
1666  for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ )
1667  array[thisindex].pos[j] = PAPI_NULL;
1668  array[thisindex].ops = NULL;
1669  array[thisindex].derived = NOT_DERIVED;
1670  ESI->NumberOfEvents--;
1671 
1672  return ( PAPI_OK );
1673 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define PAPI_ENOEVNT
Definition: papi.h:258
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
#define PAPI_UE_AND_MASK
int _papi_hwi_query_native_event(unsigned int EventCode)
#define PAPI_NULL
Definition: papi.h:290
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
#define PAPI_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define IS_NATIVE(EventCode)
Definition: papi.h:226
#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:59
hwi_presets_t user_defined_events[PAPI_MAX_USER_EVENTS]
Definition: papi_internal.c:58
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 1003 of file papi_internal.c.

1004 {
1006  int i;
1007 
1008  i = ESI->EventSetIndex;
1009 
1011 
1012  _papi_hwi_free_EventSet( ESI );
1013 
1014  /* do bookkeeping for PAPI_EVENTSET_MAP */
1015 
1016  map->dataSlotArray[i] = NULL;
1017  map->availSlots++;
1018  map->fullSlots--;
1019 
1021 
1022  return PAPI_OK;
1023 }
return PAPI_OK
Definition: linux-nvml.c:458
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:55
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 118 of file papi_internal.c.

118  {
119  INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
120 
121  // if call is just to reset and start over, set both flags to show nothing saved yet
122  if (update_flag < 0) {
124  papi_event_code = -1;
125  return;
126  }
127 
128  // if 0, it is being set prior to calling a component, if >0 it is being changed by the component
129  papi_event_code_changed = update_flag;
130  // save the event code passed in
131  papi_event_code = event_code;
132  return;
133 }
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 89 of file papi_internal.c.

89  {
90  INTDBG("event_string: %s\n", event_string);
91  if (papi_event_string != NULL) {
93  papi_event_string = NULL;
94  }
95  if (event_string != NULL) {
96  papi_event_string = strdup(event_string);
97  }
98  return;
99 }
char * papi_event_string
Definition: papi_internal.c:87
#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 1971 of file papi_internal.c.

1972 {
1974 
1976 
1978 
1981  0x00, sizeof ( DynamicArray_t ) );
1982 
1984 
1987  }
1988  memset( &_papi_hwi_system_info, 0x0, sizeof ( _papi_hwi_system_info ) );
1989 
1990 }
#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:55
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:711
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 600 of file papi_internal.c.

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

Here is the call graph for this function:

Variable Documentation

char** _papi_errlist

Definition at line 80 of file papi_internal.c.

PAPI_debug_handler_t _papi_hwi_debug_handler

Definition at line 54 of file papi_internal.c.

int _papi_hwi_errno

Definition at line 56 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 57 of file papi_internal.c.

papi_mdi_t _papi_hwi_system_info

Definition at line 55 of file papi_internal.c.

int _papi_hwi_using_signal[PAPI_NSIG]

Definition at line 363 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 52 of file papi_internal.c.

int papi_num_components

Definition at line 1899 of file papi_internal.c.