PAPI  5.3.2.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 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)
 
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_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 _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 90 of file papi_internal.h.

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

Definition at line 92 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_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 98 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 91 of file papi_internal.h.

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

Definition at line 88 of file papi_internal.h.

#define hwd_context_t   void

Definition at line 106 of file papi_internal.h.

#define hwd_control_state_t   void

Definition at line 107 of file papi_internal.h.

#define hwd_reg_alloc_t   void

Definition at line 108 of file papi_internal.h.

#define hwd_register_t   void

Definition at line 109 of file papi_internal.h.

#define hwd_siginfo_t   void

Definition at line 110 of file papi_internal.h.

#define hwd_ucontext_t   void

Definition at line 111 of file papi_internal.h.

#define inline_static   inline static

Definition at line 123 of file papi_internal.h.

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

Definition at line 85 of file papi_internal.h.

#define LOWLEVEL_TLS   PAPI_NUM_TLS+0

Definition at line 79 of file papi_internal.h.

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

Definition at line 89 of file papi_internal.h.

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

Definition at line 86 of file papi_internal.h.

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

Definition at line 93 of file papi_internal.h.

#define NEED_CONTEXT   1

Definition at line 97 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 80 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 100 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 81 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 87 of file papi_internal.h.

Typedef Documentation

Definition at line 361 of file papi_internal.h.

Function Documentation

int _papi_hwi_add_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1104 of file papi_internal.c.

1105 {
1106  int i, j, thisindex, remap, retval = PAPI_OK;
1107  int cidx;
1108 
1109  cidx=_papi_hwi_component_index( EventCode );
1110  if (cidx<0) return PAPI_ENOCMP;
1111 
1112  /* Sanity check that the new EventCode is from the same component */
1113  /* as previous events. */
1114 
1115  if ( ESI->CmpIdx < 0 ) {
1116  if ( ( retval = _papi_hwi_assign_eventset( ESI, cidx)) != PAPI_OK ) {
1117  return retval;
1118  }
1119  } else {
1120  if ( ESI->CmpIdx != cidx ) {
1121  return PAPI_EINVAL;
1122  }
1123  }
1124 
1125  /* Make sure the event is not present and get the next free slot. */
1126  thisindex = get_free_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1127  if ( thisindex < PAPI_OK ) {
1128  return thisindex;
1129  }
1130 
1131  APIDBG("Adding event to slot %d of EventSet %d\n",thisindex,ESI->EventSetIndex);
1132 
1133  /* If it is a software MPX EventSet, add it to the multiplex data structure */
1134  /* and this thread's multiplex list */
1135 
1136  if ( !_papi_hwi_is_sw_multiplex( ESI ) ) {
1137 
1138  /* Handle preset case */
1139  if ( IS_PRESET(EventCode) ) {
1140  int count;
1141  int preset_index = EventCode & ( int ) PAPI_PRESET_AND_MASK;
1142 
1143  /* Check if it's within the valid range */
1144  if ( ( preset_index < 0 ) || ( preset_index >= PAPI_MAX_PRESET_EVENTS ) ) {
1145  return PAPI_EINVAL;
1146  }
1147 
1148  /* count the number of native events in this preset */
1149  count = ( int ) _papi_hwi_presets[preset_index].count;
1150 
1151  /* Check if event exists */
1152  if ( !count ) {
1153  return PAPI_ENOEVNT;
1154  }
1155 
1156  /* check if the native events have been used as overflow events */
1157  /* this is not allowed */
1158  if ( ESI->state & PAPI_OVERFLOWING ) {
1159  for( i = 0; i < count; i++ ) {
1160  for( j = 0; j < ESI->overflow.event_counter; j++ ) {
1161  if ( ESI->overflow.EventCode[j] ==(int)
1162  ( _papi_hwi_presets[preset_index].code[i] ) ) {
1163  return PAPI_ECNFLCT;
1164  }
1165  }
1166  }
1167  }
1168 
1169  /* Try to add the preset. */
1170 
1171  remap = add_native_events( ESI,
1172  _papi_hwi_presets[preset_index].code,
1173  count, &ESI->EventInfoArray[thisindex] );
1174  if ( remap < 0 ) {
1175  return remap;
1176  }
1177  else {
1178  /* Fill in the EventCode (machine independent) information */
1179  ESI->EventInfoArray[thisindex].event_code =
1180  ( unsigned int ) EventCode;
1181  ESI->EventInfoArray[thisindex].derived =
1182  _papi_hwi_presets[preset_index].derived_int;
1183  ESI->EventInfoArray[thisindex].ops =
1184  _papi_hwi_presets[preset_index].postfix;
1185  ESI->NumberOfEvents++;
1187 
1188  }
1189  }
1190  /* Handle adding Native events */
1191  else if ( IS_NATIVE(EventCode) ) {
1192 
1193  /* Check if native event exists */
1194  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) != PAPI_OK ) {
1195  return PAPI_ENOEVNT;
1196  }
1197 
1198  /* check if the native events have been used as overflow events */
1199  /* This is not allowed */
1200  if ( ESI->state & PAPI_OVERFLOWING ) {
1201  for( j = 0; j < ESI->overflow.event_counter; j++ ) {
1202  if ( EventCode == ESI->overflow.EventCode[j] ) {
1203  return PAPI_ECNFLCT;
1204  }
1205  }
1206  }
1207 
1208  /* Try to add the native event. */
1209 
1210  remap = add_native_events( ESI, (unsigned int *)&EventCode, 1,
1211  &ESI->EventInfoArray[thisindex] );
1212 
1213  if ( remap < 0 ) {
1214  return remap;
1215  } else {
1216 
1217  /* Fill in the EventCode (machine independent) information */
1218  ESI->EventInfoArray[thisindex].event_code =
1219  ( unsigned int ) EventCode;
1220  ESI->NumberOfEvents++;
1222 
1223  }
1224  } else if ( IS_USER_DEFINED( EventCode ) ) {
1225  int count;
1226  int index = EventCode & PAPI_UE_AND_MASK;
1227 
1228  if ( index < 0 || index >= (int)_papi_user_events_count )
1229  return ( PAPI_EINVAL );
1230 
1231  count = ( int ) _papi_user_events[index].count;
1232 
1233  for ( i = 0; i < count; i++ ) {
1234  for ( j = 0; j < ESI->overflow.event_counter; j++ ) {
1235  if ( ESI->overflow.EventCode[j] ==
1236  _papi_user_events[index].events[i] ) {
1237  return ( PAPI_EBUG );
1238  }
1239  }
1240  }
1241 
1242  remap = add_native_events( ESI,
1243  (unsigned int*)_papi_user_events[index].events,
1244  count, &ESI->EventInfoArray[thisindex] );
1245 
1246  if ( remap < 0 ) {
1247  return remap;
1248  } else {
1249  ESI->EventInfoArray[thisindex].event_code
1250  = (unsigned int) EventCode;
1251  ESI->EventInfoArray[thisindex].derived
1252  = DERIVED_POSTFIX;
1253  ESI->EventInfoArray[thisindex].ops
1254  = _papi_user_events[index].operation;
1255  ESI->NumberOfEvents++;
1257  }
1258  } else {
1259 
1260  /* not Native, Preset, or User events */
1261 
1262  return PAPI_EBUG;
1263  }
1264  }
1265  else {
1266 
1267  /* Multiplexing is special. See multiplex.c */
1268 
1269  retval = mpx_add_event( &ESI->multiplex.mpx_evset, EventCode,
1270  ESI->domain.domain,
1271  ESI->granularity.granularity );
1272 
1273 
1274  if ( retval < PAPI_OK ) {
1275  return retval;
1276  }
1277 
1278  /* Relevant (???) */
1279  ESI->EventInfoArray[thisindex].event_code = ( unsigned int ) EventCode;
1280  ESI->EventInfoArray[thisindex].derived = NOT_DERIVED;
1281 
1282  ESI->NumberOfEvents++;
1283 
1284  /* event is in the EventInfoArray but not mapped to the NativeEvents */
1285  /* this causes issues if you try to set overflow on the event. */
1286  /* in theory this wouldn't matter anyway. */
1287  }
1288 
1289  /* reinstate the overflows if any */
1290  retval=update_overflow( ESI );
1291 
1292  return retval;
1293 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
int _papi_hwi_query_native_event(unsigned int EventCode)
#define PAPI_ENOEVNT
Definition: fpapi.h:112
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define PAPI_ENOCMP
Definition: fpapi.h:122
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_OVERFLOWING
Definition: fpapi.h:33
#define PAPI_ECNFLCT
Definition: fpapi.h:113
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define 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]
static int update_overflow(EventSetInfo_t *ESI)
char events[MAX_EVENTS][BUFSIZ]
int mpx_add_event(MPX_EventSet **mpx_events, int EventCode, int domain, int granularity)
Definition: sw_multiplex.c:305
EventInfo_t * EventInfoArray
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
#define PAPI_EBUG
Definition: fpapi.h:111
char operation[USER_EVENT_OPERATION_LEN]
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_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
user_defined_event_t * _papi_user_events
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
unsigned int _papi_user_events_count
#define DERIVED_POSTFIX
Definition: papi_internal.h:75
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 555 of file papi_internal.c.

556 {
557  int retval;
558  size_t max_counters;
559  char *ptr;
560  unsigned int i, j;
561 
562  /* If component doesn't exist... */
563  if (_papi_hwi_invalid_cmp(cidx)) return PAPI_ECMP;
564 
565  /* Assigned at create time */
566  ESI->domain.domain = _papi_hwd[cidx]->cmp_info.default_domain;
567  ESI->granularity.granularity =
568  _papi_hwd[cidx]->cmp_info.default_granularity;
569  ESI->CmpIdx = cidx;
570 
571  /* ??? */
572  max_counters = ( size_t ) _papi_hwd[cidx]->cmp_info.num_mpx_cntrs;
573 
574  ESI->ctl_state = (hwd_control_state_t *) papi_calloc( 1, (size_t)
575  _papi_hwd[cidx]->size.control_state );
576  ESI->sw_stop = (long long *) papi_calloc( ( size_t ) max_counters,
577  sizeof ( long long ) );
578  ESI->hw_start = ( long long * ) papi_calloc( ( size_t ) max_counters,
579  sizeof ( long long ) );
580  ESI->EventInfoArray = ( EventInfo_t * ) papi_calloc( (size_t) max_counters,
581  sizeof ( EventInfo_t ) );
582 
583  /* allocate room for the native events and for the component-private */
584  /* register structures */
585  /* ugh is there a cleaner way to allocate this? vmw */
586  ESI->NativeInfoArray = ( NativeInfo_t * )
587  papi_calloc( ( size_t ) max_counters, sizeof ( NativeInfo_t ));
588 
589  ESI->NativeBits = papi_calloc(( size_t ) max_counters,
590  ( size_t ) _papi_hwd[cidx]->size.reg_value );
591 
592  /* NOTE: the next two malloc allocate blocks of memory that are later */
593  /* parcelled into overflow and profile arrays */
594  ESI->overflow.deadline = ( long long * )
595  papi_malloc( ( sizeof ( long long ) +
596  sizeof ( int ) * 3 ) * ( size_t ) max_counters );
597 
598  ESI->profile.prof = ( PAPI_sprofil_t ** )
599  papi_malloc( ( sizeof ( PAPI_sprofil_t * ) * ( size_t ) max_counters +
600  ( size_t ) max_counters * sizeof ( int ) * 4 ) );
601 
602  /* If any of these allocations failed, free things up and fail */
603 
604  if ( ( ESI->ctl_state == NULL ) ||
605  ( ESI->sw_stop == NULL ) ||
606  ( ESI->hw_start == NULL ) ||
607  ( ESI->NativeInfoArray == NULL ) ||
608  ( ESI->NativeBits == NULL ) ||
609  ( ESI->EventInfoArray == NULL ) ||
610  ( ESI->profile.prof == NULL ) ||
611  ( ESI->overflow.deadline == NULL ) ) {
612 
613  if ( ESI->sw_stop ) papi_free( ESI->sw_stop );
614  if ( ESI->hw_start ) papi_free( ESI->hw_start );
615  if ( ESI->EventInfoArray ) papi_free( ESI->EventInfoArray );
616  if ( ESI->NativeInfoArray ) papi_free( ESI->NativeInfoArray );
617  if ( ESI->NativeBits ) papi_free( ESI->NativeBits );
618  if ( ESI->ctl_state ) papi_free( ESI->ctl_state );
619  if ( ESI->overflow.deadline ) papi_free( ESI->overflow.deadline );
620  if ( ESI->profile.prof ) papi_free( ESI->profile.prof );
621  papi_free( ESI );
622  return PAPI_ENOMEM;
623  }
624 
625 
626  /* Carve up the overflow block into separate arrays */
627  ptr = ( char * ) ESI->overflow.deadline;
628  ptr += sizeof ( long long ) * max_counters;
629  ESI->overflow.threshold = ( int * ) ptr;
630  ptr += sizeof ( int ) * max_counters;
631  ESI->overflow.EventIndex = ( int * ) ptr;
632  ptr += sizeof ( int ) * max_counters;
633  ESI->overflow.EventCode = ( int * ) ptr;
634 
635  /* Carve up the profile block into separate arrays */
636  ptr = ( char * ) ESI->profile.prof +
637  ( sizeof ( PAPI_sprofil_t * ) * max_counters );
638  ESI->profile.count = ( int * ) ptr;
639  ptr += sizeof ( int ) * max_counters;
640  ESI->profile.threshold = ( int * ) ptr;
641  ptr += sizeof ( int ) * max_counters;
642  ESI->profile.EventIndex = ( int * ) ptr;
643  ptr += sizeof ( int ) * max_counters;
644  ESI->profile.EventCode = ( int * ) ptr;
645 
646  /* initialize_EventInfoArray */
647 
648  for ( i = 0; i < max_counters; i++ ) {
649  ESI->EventInfoArray[i].event_code=( unsigned int ) PAPI_NULL;
650  ESI->EventInfoArray[i].ops = NULL;
652  for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
653  ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
654  }
655  }
656 
657  /* initialize_NativeInfoArray */
658  for( i = 0; i < max_counters; i++ ) {
659  ESI->NativeInfoArray[i].ni_event = -1;
660  ESI->NativeInfoArray[i].ni_position = -1;
661  ESI->NativeInfoArray[i].ni_owners = 0;
662  ESI->NativeInfoArray[i].ni_bits = ((unsigned char*)ESI->NativeBits) +
663  (i*_papi_hwd[cidx]->size.reg_value);
664  }
665 
666  ESI->NativeCount = 0;
667 
668  ESI->state = PAPI_STOPPED;
669 
670  /* these used to be init_config */
671  retval = _papi_hwd[cidx]->init_control_state( ESI->ctl_state );
672  retval |= _papi_hwd[cidx]->set_domain( ESI->ctl_state, ESI->domain.domain);
673 
674  return retval;
675 }
#define PAPI_ENOMEM
Definition: fpapi.h:107
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
hwd_register_t * ni_bits
#define PAPI_NULL
Definition: fpapi.h:13
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
hwd_register_t * NativeBits
EventSetDomainInfo_t domain
#define PAPI_STOPPED
Definition: fpapi.h:29
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
#define PAPI_ECMP
Definition: fpapi.h:109
PAPI_sprofil_t ** prof
long long
Definition: iozone.c:19827
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
long long * hw_start
again struct sockaddr sizeof(struct sockaddr_in))
EventSetGranularityInfo_t granularity
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
long long * sw_stop
int
Definition: iozone.c:18528
unsigned int event_code
struct papi_vectors * _papi_hwd[]
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 1509 of file papi_internal.c.

1510 {
1511  int i, j, num_cntrs, retval;
1512  hwd_context_t *context;
1513  int EventCode;
1515  if ( !_papi_hwi_invalid_cmp( ESI->CmpIdx ) ) {
1516  num_cntrs = _papi_hwd[ESI->CmpIdx]->cmp_info.num_mpx_cntrs;
1517 
1518  for(i=0;i<num_cntrs;i++) {
1519 
1520  EventCode=ESI->EventInfoArray[i].event_code;
1521 
1522  /* skip if event not there */
1523  if ( EventCode == PAPI_NULL ) continue;
1524 
1525  /* If it is a MPX EventSet, remove it from the multiplex */
1526  /* data structure and this thread's multiplex list */
1527 
1528  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1529  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1530  if ( retval < PAPI_OK )
1531  return retval;
1532  } else {
1533 
1534  native = ESI->NativeInfoArray;
1535 
1536  /* clear out ESI->NativeInfoArray */
1537  /* do we really need to do this, seeing as we free() it later? */
1538 
1539  for( j = 0; j < ESI->NativeCount; j++ ) {
1540  native[j].ni_event = -1;
1541  native[j].ni_position = -1;
1542  native[j].ni_owners = 0;
1543  /* native[j].ni_bits?? */
1544  }
1545  }
1546 
1547  /* do we really need to do this, seeing as we free() it later? */
1548  ESI->EventInfoArray[i].event_code= ( unsigned int ) PAPI_NULL;
1549  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
1550  ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
1551  }
1552  ESI->EventInfoArray[i].ops = NULL;
1554  }
1555 
1556  context = _papi_hwi_get_context( ESI, NULL );
1557  /* calling with count of 0 equals a close? */
1558  retval = _papi_hwd[ESI->CmpIdx]->update_control_state( ESI->ctl_state,
1559  NULL, 0, context);
1560  if (retval!=PAPI_OK) {
1561  return retval;
1562  }
1563  }
1564 
1565  ESI->CmpIdx = -1;
1566  ESI->NumberOfEvents = 0;
1567  ESI->NativeCount = 0;
1568 
1569  if ( ( ESI->state & PAPI_MULTIPLEXING ) && ESI->multiplex.mpx_evset )
1570  papi_free( ESI->multiplex.mpx_evset );
1571 
1572  if ( ( ESI->state & PAPI_CPU_ATTACH ) && ESI->CpuInfo )
1574 
1575  if ( ESI->ctl_state )
1576  papi_free( ESI->ctl_state );
1577 
1578  if ( ESI->sw_stop )
1579  papi_free( ESI->sw_stop );
1580 
1581  if ( ESI->hw_start )
1582  papi_free( ESI->hw_start );
1583 
1584  if ( ESI->EventInfoArray )
1585  papi_free( ESI->EventInfoArray );
1586 
1587  if ( ESI->NativeInfoArray )
1588  papi_free( ESI->NativeInfoArray );
1589 
1590  if ( ESI->NativeBits )
1591  papi_free( ESI->NativeBits );
1592 
1593  if ( ESI->overflow.deadline )
1594  papi_free( ESI->overflow.deadline );
1595 
1596  if ( ESI->profile.prof )
1597  papi_free( ESI->profile.prof );
1598 
1599  ESI->ctl_state = NULL;
1600  ESI->sw_stop = NULL;
1601  ESI->hw_start = NULL;
1602  ESI->EventInfoArray = NULL;
1603  ESI->NativeInfoArray = NULL;
1604  ESI->NativeBits = NULL;
1605 
1606  memset( &ESI->domain, 0x0, sizeof(EventSetDomainInfo_t) );
1607  memset( &ESI->granularity, 0x0, sizeof(EventSetGranularityInfo_t) );
1608  memset( &ESI->overflow, 0x0, sizeof(EventSetOverflowInfo_t) );
1609  memset( &ESI->multiplex, 0x0, sizeof(EventSetMultiplexInfo_t) );
1610  memset( &ESI->attach, 0x0, sizeof(EventSetAttachInfo_t) );
1611  memset( &ESI->cpu, 0x0, sizeof(EventSetCpuInfo_t) );
1612  memset( &ESI->profile, 0x0, sizeof(EventSetProfileInfo_t) );
1613  memset( &ESI->inherit, 0x0, sizeof(EventSetInheritInfo_t) );
1614 
1615  ESI->CpuInfo = NULL;
1616 
1617  return PAPI_OK;
1618 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
memset(eventId, 0, size)
#define PAPI_CPU_ATTACH
Definition: papi.h:455
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define PAPI_NULL
Definition: fpapi.h:13
#define papi_free(a)
Definition: papi_memory.h:35
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
EventSetAttachInfo_t attach
hwd_register_t * NativeBits
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_MULTIPLEXING
Definition: fpapi.h:35
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
unsigned int event_code
struct papi_vectors * _papi_hwd[]
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 342 of file papi_internal.c.

342  {
343 
344  int cidx;
345  int event_index;
346 
347  SUBDBG("Trying to find component for native_event %#x\n",event_code);
348 
349  /* currently assume presets are for component 0 only */
350  if (event_code&PAPI_PRESET_MASK) {
351  SUBDBG("Event %#x is a PRESET, assigning component %d\n",
352  event_code,0);
353  return 0;
354  }
355 
356  event_index=event_code&PAPI_NATIVE_AND_MASK;
357 
358  if ( (event_index < 0) || (event_index>=num_native_events)) {
359  SUBDBG("Event index %#x is out of range\n",event_index);
360  return PAPI_ENOEVNT;
361  }
362 
363  cidx=_papi_native_events[event_index].cidx;
364 
365  SUBDBG("Found event code %d from %d, %#x\n",cidx,event_index,event_code);
366 
367  if ((cidx<0) || (cidx >= papi_num_components)) return PAPI_ENOCMP;
368 
369  return cidx;
370 }
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:73
#define PAPI_ENOEVNT
Definition: fpapi.h:112
#define PAPI_ENOCMP
Definition: fpapi.h:122
#define PAPI_PRESET_MASK
static int cidx
Definition: event_info.c:40
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int papi_num_components
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:74

Here is the caller graph for this function:

int _papi_hwi_convert_eventset_to_multiplex ( _papi_int_multiplex_t mpx)

Definition at line 1621 of file papi_internal.c.

1622 {
1623  int retval, i, j = 0, *mpxlist = NULL;
1624  EventSetInfo_t *ESI = mpx->ESI;
1625  int flags = mpx->flags;
1626 
1627  /* If there are any events in the EventSet,
1628  convert them to multiplex events */
1629 
1630  if ( ESI->NumberOfEvents ) {
1631 
1632  mpxlist =
1633  ( int * ) papi_malloc( sizeof ( int ) *
1634  ( size_t ) ESI->NumberOfEvents );
1635  if ( mpxlist == NULL )
1636  return ( PAPI_ENOMEM );
1637 
1638  /* Build the args to MPX_add_events(). */
1639 
1640  /* Remember the EventInfoArray can be sparse
1641  and the data can be non-contiguous */
1642 
1643  for ( i = 0; i < EventInfoArrayLength( ESI ); i++ )
1644  if ( ESI->EventInfoArray[i].event_code !=
1645  ( unsigned int ) PAPI_NULL )
1646  mpxlist[j++] = ( int ) ESI->EventInfoArray[i].event_code;
1647 
1648  /* Resize the EventInfo_t array */
1649 
1650  if ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex == 0 ) ||
1651  ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) &&
1652  ( flags & PAPI_MULTIPLEX_FORCE_SW ) ) ) {
1653  retval =
1654  MPX_add_events( &ESI->multiplex.mpx_evset, mpxlist, j,
1655  ESI->domain.domain,
1656  ESI->granularity.granularity );
1657  if ( retval != PAPI_OK ) {
1658  papi_free( mpxlist );
1659  return ( retval );
1660  }
1661  }
1662 
1663  papi_free( mpxlist );
1664  }
1665 
1666  /* Update the state before initialization! */
1667 
1668  ESI->state |= PAPI_MULTIPLEXING;
1669  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex &&
1670  ( flags & PAPI_MULTIPLEX_FORCE_SW ) )
1672  ESI->multiplex.ns = ( int ) mpx->ns;
1673 
1674  return ( PAPI_OK );
1675 }
#define PAPI_ENOMEM
Definition: fpapi.h:107
static int EventInfoArrayLength(const EventSetInfo_t *ESI)
long long flags
Definition: iozone.c:12330
#define PAPI_NULL
Definition: fpapi.h:13
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
EventSetDomainInfo_t domain
return PAPI_OK
Definition: linux-nvml.c:458
int MPX_add_events(MPX_EventSet **mpx_events, int *event_list, int num_events, int domain, int granularity)
Definition: sw_multiplex.c:676
#define PAPI_MULTIPLEXING
Definition: fpapi.h:35
int i
Definition: fileop.c:140
#define PAPI_MULTIPLEX_FORCE_SW
Definition: fpapi.h:46
EventInfo_t * EventInfoArray
EventSetMultiplexInfo_t multiplex
EventSetGranularityInfo_t granularity
int
Definition: iozone.c:18528
unsigned int event_code
struct papi_vectors * _papi_hwd[]
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 730 of file papi_internal.c.

731 {
732  EventSetInfo_t *ESI;
733  int retval;
734 
735  /* Is the EventSet already in existence? */
736 
737  if ( ( EventSet == NULL ) || ( handle == NULL ) )
738  return PAPI_EINVAL;
739 
740  if ( *EventSet != PAPI_NULL )
741  return PAPI_EINVAL;
742 
743  /* Well, then allocate a new one. Use n to keep track of a NEW EventSet */
744 
745  retval = create_EventSet( &ESI );
746  if ( retval != PAPI_OK )
747  return retval;
748 
749  ESI->CmpIdx = -1; /* when eventset is created, it is not decided yet which component it belongs to, until first event is added */
750  ESI->state = PAPI_STOPPED;
751 
752  /* Add it to the global table */
753 
754  retval = add_EventSet( ESI, handle );
755  if ( retval < PAPI_OK ) {
757  return retval ;
758  }
759 
760  *EventSet = ESI->EventSetIndex;
761 
762  INTDBG( "(%p,%p): new EventSet in slot %d\n",
763  ( void * ) EventSet, handle, *EventSet );
764 
765  return retval;
766 }
#define PAPI_NULL
Definition: fpapi.h:13
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_STOPPED
Definition: fpapi.h:29
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int EventSet
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 1977 of file papi_internal.c.

1978 {
1979  int i = 0;
1980  while ( _papi_hwi_derived[i].name != NULL ) {
1981  if ( strcasecmp( tmp, _papi_hwi_derived[i].name ) == 0 ) {
1982  *code = _papi_hwi_derived[i].value;
1983  return PAPI_OK;
1984  }
1985  i++;
1986  }
1987  INTDBG( "Invalid derived string %s\n", tmp );
1988  return PAPI_EINVAL;
1989 }
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 1775 of file papi_internal.c.

1777 {
1778  /* This function is not used and shouldn't be called. */
1779  ( void ) EventSet; /*unused */
1780  ( void ) address; /*unused */
1781  ( void ) overflow_vector; /*unused */
1782  ( void ) context; /*unused */
1783  return;
1784 }
void
Definition: iozone.c:18627
int EventSet

Here is the caller graph for this function:

int _papi_hwi_eventcode_to_native ( int  event_code)

Definition at line 391 of file papi_internal.c.

391  {
392 
393  int result;
394  int event_index;
395 
396  SUBDBG("Looking for event for native_event %#x\n",event_code);
397 
398  event_index=event_code&PAPI_NATIVE_AND_MASK;
399  if (event_index>=num_native_events) return PAPI_ENOEVNT;
400 
401  result=_papi_native_events[event_index].component_event;
402 
403  SUBDBG("Found result %#x\n",result);
404 
405  return result;
406 
407 }
static struct native_event_info * _papi_native_events
Definition: papi_internal.c:73
#define PAPI_ENOEVNT
Definition: fpapi.h:112
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define PAPI_NATIVE_AND_MASK
static int num_native_events
Definition: papi_internal.c:74

Here is the caller graph for this function:

void _papi_hwi_free_EventSet ( EventSetInfo_t ESI)

Definition at line 685 of file papi_internal.c.

686 {
688 
689 #ifdef DEBUG
690  memset( ESI, 0x00, sizeof ( EventSetInfo_t ) );
691 #endif
692  papi_free( ESI );
693 
694 }
memset(eventId, 0, size)
#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:

hwd_context_t* _papi_hwi_get_context ( EventSetInfo_t ESI,
int is_dirty 
)

Definition at line 2280 of file papi_internal.c.

2281 {
2282  INTDBG("Entry: ESI: %p, is_dirty: %p\n", ESI, is_dirty);
2283  int dirty_ctx;
2284  hwd_context_t *ctx=NULL;
2285 
2286  /* assume for now the control state is clean (last updated by this ESI) */
2287  dirty_ctx = 0;
2288 
2289  /* get a context pointer based on if we are counting for a thread or for a cpu */
2290  if (ESI->state & PAPI_CPU_ATTACHED) {
2291  /* use cpu context */
2292  ctx = ESI->CpuInfo->context[ESI->CmpIdx];
2293 
2294  /* if the user wants to know if the control state was last set by the same event set, tell him */
2295  if (is_dirty != NULL) {
2296  if (ESI->CpuInfo->from_esi != ESI) {
2297  dirty_ctx = 1;
2298  }
2299  *is_dirty = dirty_ctx;
2300  }
2301  ESI->CpuInfo->from_esi = ESI;
2302 
2303  } else {
2304 
2305  /* use thread context */
2306  ctx = ESI->master->context[ESI->CmpIdx];
2307 
2308  /* if the user wants to know if the control state was last set by the same event set, tell him */
2309  if (is_dirty != NULL) {
2310  if (ESI->master->from_esi != ESI) {
2311  dirty_ctx = 1;
2312  }
2313  *is_dirty = dirty_ctx;
2314  }
2315  ESI->master->from_esi = ESI;
2316 
2317  }
2318  return( ctx );
2319 }
#define INTDBG(format, args...)
Definition: papi_debug.h:65
struct _CpuInfo * CpuInfo
struct _ThreadInfo * master
#define PAPI_CPU_ATTACHED
Definition: fpapi.h:37

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 2177 of file papi_internal.c.

2179 {
2180  int retval;
2181  int cidx;
2182 
2183  cidx = _papi_hwi_component_index( EventCode );
2184  if (cidx<0) return PAPI_ENOCMP;
2185 
2186  if (_papi_hwd[cidx]->cmp_info.disabled) return PAPI_ENOCMP;
2187 
2188  if ( EventCode & PAPI_NATIVE_MASK ) {
2189 
2190  /* clear the event info */
2191  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2192  info->event_code = ( unsigned int ) EventCode;
2193 
2194  retval = _papi_hwd[cidx]->ntv_code_to_info(
2195  _papi_hwi_eventcode_to_native(EventCode), info);
2196 
2197  /* If component error, it's missing the ntv_code_to_info vector */
2198  /* so we'll have to fake it. */
2199  if ( retval == PAPI_ECMP ) {
2200 
2201 
2202  SUBDBG("missing NTV_CODE_TO_INFO, faking\n");
2203  /* Fill in the info structure */
2204 
2205  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2206  _papi_hwi_eventcode_to_native(EventCode),
2207  info->symbol,
2208  sizeof(info->symbol)) ) == PAPI_OK ) {
2209 
2210  } else {
2211  SUBDBG("failed ntv_code_to_name\n");
2212  return retval;
2213  }
2214 
2215  retval = _papi_hwd[cidx]->ntv_code_to_descr(
2216  _papi_hwi_eventcode_to_native(EventCode),
2217  info->long_descr,
2218  sizeof ( info->long_descr));
2219  if (retval!=PAPI_OK) {
2220  SUBDBG("Failed ntv_code_to_descr()\n");
2221  }
2222 
2223  }
2225  _papi_hwd[cidx]->cmp_info.short_name,
2226  info->symbol,
2227  info->symbol,
2228  sizeof(info->symbol) );
2229 
2230  return retval;
2231  }
2232 
2233  return PAPI_ENOEVNT;
2234 }
memset(eventId, 0, size)
#define PAPI_NATIVE_MASK
#define PAPI_ENOEVNT
Definition: fpapi.h:112
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:964
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:961
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_ENOCMP
Definition: fpapi.h:122
static int cidx
Definition: event_info.c:40
#define PAPI_ECMP
Definition: fpapi.h:109
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
again struct sockaddr sizeof(struct sockaddr_in))
int
Definition: iozone.c:18528
int _papi_hwi_component_index(int event_code)
struct papi_vectors * _papi_hwd[]
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
Definition: papi_internal.c:95
int _papi_hwi_eventcode_to_native(int event_code)
unsigned int event_code
Definition: papi.h:959
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

PAPI_os_info_t* _papi_hwi_get_os_info ( void  )
int _papi_hwi_get_preset_event_info ( int  EventCode,
PAPI_event_info_t info 
)

Definition at line 2021 of file papi_internal.c.

2022 {
2023  int i = EventCode & PAPI_PRESET_AND_MASK;
2024  unsigned int j;
2025 
2026  if ( _papi_hwi_presets[i].symbol ) { /* if the event is in the preset table */
2027  /* set whole structure to 0 */
2028  memset( info, 0, sizeof ( PAPI_event_info_t ) );
2029 
2030  info->event_code = ( unsigned int ) EventCode;
2031  strncpy( info->symbol, _papi_hwi_presets[i].symbol,
2032  sizeof(info->symbol));
2033 
2034  if ( _papi_hwi_presets[i].short_descr != NULL )
2035  strncpy( info->short_descr, _papi_hwi_presets[i].short_descr,
2036  sizeof ( info->short_descr ) );
2037 
2038  if ( _papi_hwi_presets[i].long_descr != NULL )
2039  strncpy( info->long_descr, _papi_hwi_presets[i].long_descr,
2040  sizeof ( info->long_descr ) );
2041 
2043  info->count = _papi_hwi_presets[i].count;
2044 
2046  info->derived, sizeof ( info->derived ) );
2047 
2048  if ( _papi_hwi_presets[i].postfix != NULL )
2049  strncpy( info->postfix, _papi_hwi_presets[i].postfix,
2050  sizeof ( info->postfix ) );
2051 
2052  for(j=0;j < info->count; j++) {
2053  info->code[j]=_papi_hwi_presets[i].code[j];
2054  strncpy(info->name[j], _papi_hwi_presets[i].name[j],
2055  sizeof(info->name[j]));
2056  }
2057 
2058  if ( _papi_hwi_presets[i].note != NULL ) {
2059  strncpy( info->note, _papi_hwi_presets[i].note,
2060  sizeof ( info->note ) );
2061  }
2062 
2063  return PAPI_OK;
2064  } else {
2065  return PAPI_ENOEVNT;
2066  }
2067 }
unsigned int count
Definition: papi.h:982
memset(eventId, 0, size)
#define PAPI_ENOEVNT
Definition: fpapi.h:112
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:964
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:961
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:1008
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:962
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
unsigned int event_type
Definition: papi.h:987
char * short_descr
Definition: papi_preset.h:25
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi.h:998
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:959
char * symbol
Definition: papi_preset.h:24
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:990
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:993
unsigned int count
Definition: papi_preset.h:29
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1004
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 305 of file papi_internal.c.

305  {
306 /* we use add error to avoid the cost of lookups, we know the errors are not there yet */
307  _papi_hwi_add_error("No error");
308  _papi_hwi_add_error("Invalid argument");
309  _papi_hwi_add_error("Insufficient memory");
310  _papi_hwi_add_error("A System/C library call failed");
311  _papi_hwi_add_error("Not supported by component");
312  _papi_hwi_add_error("Access to the counters was lost or interrupted");
313  _papi_hwi_add_error("Internal error, please send mail to the developers");
314  _papi_hwi_add_error("Event does not exist");
315  _papi_hwi_add_error("Event exists, but cannot be counted due to hardware resource limits");
316  _papi_hwi_add_error("EventSet is currently not running");
317  _papi_hwi_add_error("EventSet is currently counting");
318  _papi_hwi_add_error("No such EventSet available");
319  _papi_hwi_add_error("Event in argument is not a valid preset");
320  _papi_hwi_add_error("Hardware does not support performance counters");
321  _papi_hwi_add_error("Unknown error code");
322  _papi_hwi_add_error("Permission level does not permit operation");
323  _papi_hwi_add_error("PAPI hasn't been initialized yet");
324  _papi_hwi_add_error("Component Index isn't set");
325  _papi_hwi_add_error("Not supported");
326  _papi_hwi_add_error("Not implemented");
327  _papi_hwi_add_error("Buffer size exceeded");
328  _papi_hwi_add_error("EventSet domain is not supported for the operation");
329  _papi_hwi_add_error("Invalid or missing event attributes");
330  _papi_hwi_add_error("Too many events or attributes");
331  _papi_hwi_add_error("Bad combination of features");
332 }
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 1687 of file papi_internal.c.

1688 {
1689  int retval, i = 0;
1690 
1692  if ( retval != PAPI_OK ) {
1693  return retval;
1694  }
1695 
1696  while ( _papi_hwd[i] ) {
1697 
1698  retval = _papi_hwi_innoculate_vector( _papi_hwd[i] );
1699  if ( retval != PAPI_OK ) {
1700  return retval;
1701  }
1702 
1703  /* We can be disabled by user before init */
1704  if (!_papi_hwd[i]->cmp_info.disabled) {
1705  retval = _papi_hwd[i]->init_component( i );
1706  _papi_hwd[i]->cmp_info.disabled=retval;
1707 
1708  /* Do some sanity checking */
1709  if (retval==PAPI_OK) {
1710  if (_papi_hwd[i]->cmp_info.num_cntrs >
1711  _papi_hwd[i]->cmp_info.num_mpx_cntrs) {
1712  fprintf(stderr,"Warning! num_cntrs is more than num_mpx_cntrs\n");
1713  }
1714 
1715  }
1716  }
1717 
1718  i++;
1719  }
1720  return PAPI_OK;
1721 }
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_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
struct papi_vectors * _papi_hwd[]
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_global_internal ( void  )

Definition at line 1727 of file papi_internal.c.

1728 {
1729 
1730  int retval;
1731 
1733 
1735 
1736  /* Global struct to maintain EventSet mapping */
1738  if ( retval != PAPI_OK ) {
1739  return retval;
1740  }
1741 
1742  _papi_hwi_system_info.pid = 0; /* Process identifier */
1743 
1744  /* PAPI_hw_info_t struct */
1746 
1747  return PAPI_OK;
1748 }
memset(eventId, 0, size)
int _papi_hwi_using_signal[PAPI_NSIG]
Definition: extras.c:363
Hardware info structure.
Definition: papi.h:775
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:57
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
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
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

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 335 of file papi_internal.c.

336 {
337  return ( cidx < 0 || cidx >= papi_num_components );
338 }
int papi_num_components

Here is the caller graph for this function:

int _papi_hwi_is_sw_multiplex ( EventSetInfo_t ESI)

Definition at line 2256 of file papi_internal.c.

2257 {
2258  /* Are we multiplexing at all */
2259  if ( ( ESI->state & PAPI_MULTIPLEXING ) == 0 ) {
2260  return 0;
2261  }
2262 
2263  /* Does the component support kernel multiplexing */
2264  if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) {
2265  /* Have we forced software multiplexing */
2266  if ( ESI->multiplex.flags == PAPI_MULTIPLEX_FORCE_SW ) {
2267  return 1;
2268  }
2269  /* Nope, using hardware multiplexing */
2270  return 0;
2271  }
2272 
2273  /* We are multiplexing but the component does not support hardware */
2274 
2275  return 1;
2276 
2277 }
#define PAPI_MULTIPLEXING
Definition: fpapi.h:35
#define PAPI_MULTIPLEX_FORCE_SW
Definition: fpapi.h:46
EventSetMultiplexInfo_t multiplex
struct papi_vectors * _papi_hwd[]

Here is the caller graph for this function:

int _papi_hwi_lookup_EventCodeIndex ( const EventSetInfo_t ESI,
unsigned int  EventCode 
)

Definition at line 798 of file papi_internal.c.

800 {
801  int i;
802  int limit = EventInfoArrayLength( ESI );
803 
804  for ( i = 0; i < limit; i++ ) {
805  if ( ESI->EventInfoArray[i].event_code == EventCode ) {
806  return i;
807  }
808  }
809 
810  return PAPI_EINVAL;
811 }
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 2237 of file papi_internal.c.

2238 {
2240  EventSetInfo_t *set;
2241 
2242  if ( ( eventset < 0 ) || ( eventset > map->totalSlots ) )
2243  return ( NULL );
2244 
2245  set = map->dataSlotArray[eventset];
2246 #ifdef DEBUG
2247  if ( ( ISLEVEL( DEBUG_THREADS ) ) && ( _papi_hwi_thread_id_fn ) &&
2248  ( set->master->tid != _papi_hwi_thread_id_fn( ) ) )
2249  return ( NULL );
2250 #endif
2251 
2252  return ( set );
2253 }
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:57
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 870 of file papi_internal.c.

871 {
872 
873  int i, event, k, n, preset_index = 0, nevt;
874  int total_events = ESI->NumberOfEvents;
875 
876  APIDBG("Mapping %d events in EventSet %d\n",
877  total_events,ESI->EventSetIndex);
878 
879  event = 0;
880  for( i = 0; i < total_events; i++ ) {
881 
882  /* find the first event that isn't PAPI_NULL */
883  /* Is this really necessary? --vmw */
884  while ( ESI->EventInfoArray[event].event_code == ( unsigned int ) PAPI_NULL ) {
885  event++;
886  }
887 
888  /* If it's a preset */
889  if ( IS_PRESET(ESI->EventInfoArray[event].event_code) ) {
890  preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_PRESET_AND_MASK;
891 
892  /* walk all sub-events in the preset */
893  for( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
894  nevt = _papi_hwi_presets[preset_index].code[k];
895  if ( nevt == PAPI_NULL ) {
896  break;
897  }
898 
899  APIDBG("Loking for subevent %#x\n",nevt);
900 
901  /* Match each sub-event to something in the Native List */
902  for( n = 0; n < ESI->NativeCount; n++ ) {
903  if ( _papi_hwi_eventcode_to_native(nevt) ==
904  ESI->NativeInfoArray[n].ni_event ) {
905  APIDBG("Found event %#x at position %d\n",
906  nevt,
907  ESI->NativeInfoArray[n].ni_position);
909  break;
910  }
911  }
912  }
913  }
914  /* It's a native event */
915  else if( IS_NATIVE(ESI->EventInfoArray[event].event_code) ) {
916  nevt = ( int ) ESI->EventInfoArray[event].event_code;
917 
918  /* Look for the event in the NativeInfoArray */
919  for( n = 0; n < ESI->NativeCount; n++ ) {
920  if ( _papi_hwi_eventcode_to_native(nevt) ==
921  ESI->NativeInfoArray[n].ni_event ) {
923  break;
924  }
925  }
926  /* It's a user-defined event */
927  } else if ( IS_USER_DEFINED(ESI->EventInfoArray[event].event_code) ) {
928  for ( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
929  nevt = _papi_user_events[preset_index].events[k];
930  if ( nevt == PAPI_NULL ) break;
931 
932  /* Match each sub-event to something in the Native List */
933  for ( n = 0; n < ESI->NativeCount; n++ ) {
936  }
937  }
938  }
939  }
940  event++;
941  }
942 }
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define PAPI_NULL
Definition: fpapi.h:13
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
#define APIDBG(format, args...)
Definition: papi_debug.h:64
int i
Definition: fileop.c:140
#define IS_NATIVE(EventCode)
Definition: papi.h:226
int k
Definition: iozone.c:19136
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
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
user_defined_event_t * _papi_user_events
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 2150 of file papi_internal.c.

2152 {
2153  int cidx;
2154  int retval;
2155 
2156  cidx = _papi_hwi_component_index( EventCode );
2157  if (cidx<0) return PAPI_ENOEVNT;
2158 
2159  if ( EventCode & PAPI_NATIVE_MASK ) {
2160  if ( (retval = _papi_hwd[cidx]->ntv_code_to_name(
2161  _papi_hwi_eventcode_to_native(EventCode),
2162  hwi_name, len) ) == PAPI_OK ) {
2163  return
2164  _papi_hwi_prefix_component_name( _papi_hwd[cidx]->cmp_info.short_name,
2165  hwi_name, hwi_name, len);
2166  } else {
2167  return (retval);
2168  }
2169  }
2170  return PAPI_ENOEVNT;
2171 }
#define PAPI_NATIVE_MASK
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
static int cidx
Definition: event_info.c:40
int _papi_hwi_component_index(int event_code)
struct papi_vectors * _papi_hwd[]
int _papi_hwi_prefix_component_name(char *component_name, char *event_name, char *out, int out_len)
Definition: papi_internal.c:95
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 2091 of file papi_internal.c.

2092 {
2093  int retval = PAPI_ENOEVNT;
2094  char name[PAPI_HUGE_STR_LEN]; /* make sure it's big enough */
2095  unsigned int i;
2096  int cidx;
2097 
2098  SUBDBG("checking all %d components\n",papi_num_components);
2100 
2101 
2102  for(cidx=0; cidx < papi_num_components; cidx++) {
2103 
2104  if (_papi_hwd[cidx]->cmp_info.disabled) continue;
2105 
2106  /* first check each component for name_to_code */
2107  retval = _papi_hwd[cidx]->ntv_name_to_code( in, ( unsigned * ) out );
2108  *out = _papi_hwi_native_to_eventcode(cidx,*out);
2109 
2110  /* If not implemented, work around */
2111  if ( retval==PAPI_ECMP) {
2112  i = 0;
2113  _papi_hwd[cidx]->ntv_enum_events( &i, PAPI_ENUM_FIRST );
2114 
2115  // _papi_hwi_lock( INTERNAL_LOCK );
2116 
2117  do {
2118  retval = _papi_hwd[cidx]->ntv_code_to_name(
2119  i,
2120  name, sizeof(name));
2121  /* printf("%#x\nname =|%s|\ninput=|%s|\n", i, name, in); */
2122  if ( retval == PAPI_OK && in != NULL) {
2123  if ( strcasecmp( name, in ) == 0 ) {
2124  *out = _papi_hwi_native_to_eventcode(cidx,i);
2125  break;
2126  } else {
2127  retval = PAPI_ENOEVNT;
2128  }
2129  } else {
2130  *out = 0;
2131  retval = PAPI_ENOEVNT;
2132  break;
2133  }
2134  } while ( ( _papi_hwd[cidx]->ntv_enum_events( &i,
2135  PAPI_ENUM_EVENTS ) ==
2136  PAPI_OK ) );
2137 
2138  // _papi_hwi_unlock( INTERNAL_LOCK );
2139  }
2140 
2141  if ( retval == PAPI_OK ) return retval;
2142  }
2143 
2144  return retval;
2145 }
#define PAPI_HUGE_STR_LEN
Definition: fpapi.h:42
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
char * _papi_hwi_strip_component_prefix(char *event_name)
int i
Definition: fileop.c:140
static int cidx
Definition: event_info.c:40
#define PAPI_ECMP
Definition: fpapi.h:109
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _papi_hwi_native_to_eventcode(int cidx, int event_code)
int papi_num_components
char * name
Definition: iozone.c:23648
struct papi_vectors * _papi_hwd[]
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 
)

Definition at line 374 of file papi_internal.c.

374  {
375 
376  int result;
377 
378  SUBDBG("Looking for component %d event %#x\n",cidx,event_code);
379 
380  result=_papi_hwi_find_native_event(cidx,event_code);
381  if (result==PAPI_ENOEVNT) {
382  /* Need to allocate */
383  result=_papi_hwi_add_native_event(event_code,cidx);
384  }
385 
386  return result;
387 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
static int _papi_hwi_add_native_event(int event, int cidx)
static int _papi_hwi_find_native_event(int cidx, int event)
static int cidx
Definition: event_info.c:40
#define SUBDBG(format, args...)
Definition: papi_debug.h:63

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 2073 of file papi_internal.c.

2074 {
2075  char name[PAPI_HUGE_STR_LEN]; /* probably overkill, */
2076  /* but should always be big enough */
2077  int cidx;
2078 
2079  cidx = _papi_hwi_component_index( EventCode );
2080  if (cidx<0) return PAPI_ENOCMP;
2081 
2082  return ( _papi_hwd[cidx]->ntv_code_to_name(
2083  _papi_hwi_eventcode_to_native(EventCode),
2084  name, sizeof(name)));
2085 }
#define PAPI_HUGE_STR_LEN
Definition: fpapi.h:42
#define PAPI_ENOCMP
Definition: fpapi.h:122
static int cidx
Definition: event_info.c:40
char * name
Definition: iozone.c:23648
int _papi_hwi_component_index(int event_code)
struct papi_vectors * _papi_hwd[]
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 1459 of file papi_internal.c.

1461 {
1462  int retval;
1463  long long *dp = NULL;
1464  int i, index;
1465 
1466  retval = _papi_hwd[ESI->CmpIdx]->read( context, ESI->ctl_state,
1467  &dp, ESI->state );
1468  if ( retval != PAPI_OK ) {
1469  return retval;
1470  }
1471 
1472  /* This routine distributes hardware counters to software counters in the
1473  order that they were added. Note that the higher level
1474  EventInfoArray[i] entries may not be contiguous because the user
1475  has the right to remove an event.
1476  But if we do compaction after remove event, this function can be
1477  changed.
1478  */
1479 
1480  for ( i = 0; i != ESI->NumberOfEvents; i++ ) {
1481 
1482  index = ESI->EventInfoArray[i].pos[0];
1483 
1484  if ( index == -1 )
1485  continue;
1486 
1487  INTDBG( "Event index %d, position is %#x\n", i, index );
1488 
1489  /* If this is not a derived event */
1490 
1491  if ( ESI->EventInfoArray[i].derived == NOT_DERIVED ) {
1492  values[i] = dp[index];
1493  INTDBG( "value: %#llx\n", values[i] );
1494  } else { /* If this is a derived event */
1495  values[i] = handle_derived( &ESI->EventInfoArray[i], dp );
1496 #ifdef DEBUG
1497  if ( values[i] < ( long long ) 0 ) {
1498  INTDBG( "Derived Event is negative!!: %lld\n", values[i] );
1499  }
1500  INTDBG( "derived value: %#llx \n", values[i] );
1501 #endif
1502  }
1503  }
1504 
1505  return PAPI_OK;
1506 }
return PAPI_OK
Definition: linux-nvml.c:458
#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]
struct papi_vectors * _papi_hwd[]
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 1374 of file papi_internal.c.

1375 {
1376  int j = 0, retval, thisindex;
1377  EventInfo_t *array;
1378 
1379  thisindex =
1380  _papi_hwi_lookup_EventCodeIndex( ESI, ( unsigned int ) EventCode );
1381  if ( thisindex < PAPI_OK )
1382  return ( thisindex );
1383 
1384  /* If it is a MPX EventSet, remove it from the multiplex data structure and
1385  this threads multiplex list */
1386 
1387  if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
1388  retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
1389  if ( retval < PAPI_OK )
1390  return ( retval );
1391  } else
1392  /* Remove the events hardware dependent stuff from the EventSet */
1393  {
1394  if ( IS_PRESET(EventCode) ) {
1395  int preset_index = EventCode & PAPI_PRESET_AND_MASK;
1396 
1397  /* Check if it's within the valid range */
1398  if ( ( preset_index < 0 ) ||
1399  ( preset_index >= PAPI_MAX_PRESET_EVENTS ) )
1400  return PAPI_EINVAL;
1401 
1402  /* Check if event exists */
1403  if ( !_papi_hwi_presets[preset_index].count )
1404  return PAPI_ENOEVNT;
1405 
1406  /* Remove the preset event. */
1407  for ( j = 0; _papi_hwi_presets[preset_index].code[j] != (unsigned int)PAPI_NULL;
1408  j++ );
1410  (int *)_papi_hwi_presets[preset_index].code, j );
1411  if ( retval != PAPI_OK )
1412  return ( retval );
1413  } else if ( IS_NATIVE(EventCode) ) {
1414  /* Check if native event exists */
1415  if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) !=
1416  PAPI_OK )
1417  return PAPI_ENOEVNT;
1418 
1419  /* Remove the native event. */
1420  retval = remove_native_events( ESI, &EventCode, 1 );
1421  if ( retval != PAPI_OK )
1422  return ( retval );
1423  } else if ( IS_USER_DEFINED( EventCode ) ) {
1424  int index = EventCode & PAPI_UE_AND_MASK;
1425 
1426  if ( (index < 0) || (index >= (int)_papi_user_events_count) )
1427  return ( PAPI_EINVAL );
1428 
1429  for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT &&
1430  _papi_user_events[index].events[j] != 0; j++ ) {
1432  _papi_user_events[index].events, j);
1433 
1434  if ( retval != PAPI_OK )
1435  return ( retval );
1436  }
1437  } else
1438  return ( PAPI_ENOEVNT );
1439  }
1440  array = ESI->EventInfoArray;
1441 
1442  /* Compact the Event Info Array list if it's not the last event */
1443  /* clear the newly empty slot in the array */
1444  for ( ; thisindex < ESI->NumberOfEvents - 1; thisindex++ )
1445  array[thisindex] = array[thisindex + 1];
1446 
1447 
1448  array[thisindex].event_code = ( unsigned int ) PAPI_NULL;
1449  for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ )
1450  array[thisindex].pos[j] = PAPI_NULL;
1451  array[thisindex].ops = NULL;
1452  array[thisindex].derived = NOT_DERIVED;
1453  ESI->NumberOfEvents--;
1454 
1455  return ( PAPI_OK );
1456 }
int _papi_hwi_is_sw_multiplex(EventSetInfo_t *ESI)
#define IS_PRESET(EventCode)
Definition: papi.h:227
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
#define PAPI_NULL
Definition: fpapi.h:13
#define IS_USER_DEFINED(EventCode)
Definition: papi.h:228
int _papi_hwi_query_native_event(unsigned int EventCode)
#define PAPI_ENOEVNT
Definition: fpapi.h:112
MPX_EventSet * mpx_evset
Definition: sw_multiplex.h:32
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
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 _papi_hwi_lookup_EventCodeIndex(const EventSetInfo_t *ESI, unsigned int EventCode)
char events[MAX_EVENTS][BUFSIZ]
EventInfo_t * EventInfoArray
static int remove_native_events(EventSetInfo_t *ESI, int *nevt, int size)
EventSetMultiplexInfo_t multiplex
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
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_UE_AND_MASK
#define PAPI_PRESET_AND_MASK
user_defined_event_t * _papi_user_events
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_EventSet ( EventSetInfo_t ESI)

Definition at line 816 of file papi_internal.c.

817 {
819  int i;
820 
821  i = ESI->EventSetIndex;
822 
824 
826 
827  /* do bookkeeping for PAPI_EVENTSET_MAP */
828 
829  map->dataSlotArray[i] = NULL;
830  map->availSlots++;
831  map->fullSlots--;
832 
834 
835  return PAPI_OK;
836 }
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:57
EventSetInfo_t ** dataSlotArray
#define INTERNAL_LOCK
Definition: papi_internal.h:85
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_shutdown_global_internal ( void  )

Definition at line 1751 of file papi_internal.c.

1752 {
1754 
1756 
1758 
1761  0x00, sizeof ( DynamicArray_t ) );
1762 
1764 
1767  }
1768  memset( &_papi_hwi_system_info, 0x0, sizeof ( _papi_hwi_system_info ) );
1769 
1770 }
memset(eventId, 0, size)
#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:57
again struct sockaddr sizeof(struct sockaddr_in))
EventSetInfo_t ** dataSlotArray
#define INTERNAL_LOCK
Definition: papi_internal.h:85
PAPI_address_map_t * map
Definition: papi.h:709
int _papi_hwi_cleanup_all_presets(void)
Definition: papi_preset.c:107

Here is the call graph for this function:

Here is the caller graph for this function:

void PAPIERROR ( char *  format,
  ... 
)

Definition at line 415 of file papi_internal.c.

416 {
417  va_list args;
418  if ( ( _papi_hwi_error_level != PAPI_QUIET ) ||
419  ( getenv( "PAPI_VERBOSE" ) ) ) {
420  va_start( args, format );
421  fprintf( stderr, "PAPI Error: " );
422  vfprintf( stderr, format, args );
423  fprintf( stderr, ".\n" );
424  va_end( args );
425  }
426 }
char * getenv()
int _papi_hwi_error_level
Definition: papi_internal.c:55
#define PAPI_QUIET
Definition: fpapi.h:38

Here is the call graph for this function:

Variable Documentation

char** _papi_errlist

Definition at line 77 of file papi_internal.c.

PAPI_debug_handler_t _papi_hwi_debug_handler

Definition at line 56 of file papi_internal.c.

int _papi_hwi_errno

Definition at line 58 of file papi_internal.c.

int _papi_hwi_error_level

Definition at line 442 of file papi_internal.h.

int _papi_hwi_num_errors

Definition at line 59 of file papi_internal.c.

papi_mdi_t _papi_hwi_system_info

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

int papi_num_components

Definition at line 1679 of file papi_internal.c.