papi_internal.h File Reference

Include dependency graph for papi_internal.h:

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

Defines

#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
#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
#define MULTIPLEX_LOCK   PAPI_NUM_LOCK+1
#define THREADS_LOCK   PAPI_NUM_LOCK+2
#define HIGHLEVEL_LOCK   PAPI_NUM_LOCK+3
#define MEMORY_LOCK   PAPI_NUM_LOCK+4
#define COMPONENT_LOCK   PAPI_NUM_LOCK+5
#define GLOBAL_LOCK   PAPI_NUM_LOCK+6
#define CPUS_LOCK   PAPI_NUM_LOCK+7
#define NAMELIB_LOCK   PAPI_NUM_LOCK+8
#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@cs.utk.edu
Dan Terpstra terpstra.utk.edu
Kevin London london@cs.utk.edu
Haihang You you@cs.utk.edu

Definition in file papi_internal.h.


Define Documentation

#define COMPONENT_LOCK   PAPI_NUM_LOCK+5

Definition at line 91 of file papi_internal.h.

#define CPUS_LOCK   PAPI_NUM_LOCK+7

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

Definition at line 92 of file papi_internal.h.

#define HIGHLEVEL_LOCK   PAPI_NUM_LOCK+3

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

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

Definition at line 90 of file papi_internal.h.

#define MULTIPLEX_LOCK   PAPI_NUM_LOCK+1

Definition at line 87 of file papi_internal.h.

#define NAMELIB_LOCK   PAPI_NUM_LOCK+8

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

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

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

01317 {
01318     INTDBG("ENTER: ESI: %p (%d), EventCode: %#x\n", ESI, ESI->EventSetIndex, EventCode);
01319 
01320     int i, j, thisindex, remap, retval = PAPI_OK;
01321     int cidx;
01322 
01323     cidx=_papi_hwi_component_index( EventCode );
01324     if (cidx<0) return PAPI_ENOCMP;
01325 
01326     /* Sanity check that the new EventCode is from the same component */
01327     /* as previous events.                                            */
01328     
01329     if ( ESI->CmpIdx < 0 ) {
01330        if ( ( retval = _papi_hwi_assign_eventset( ESI, cidx)) != PAPI_OK ) {
01331           INTDBG("EXIT: Error assigning eventset to component index %d\n", cidx);
01332           return retval;
01333        }
01334     } else {
01335        if ( ESI->CmpIdx != cidx ) {
01336             INTDBG("EXIT: Event is not valid for component index %d\n", cidx);
01337             return PAPI_EINVAL;
01338        }
01339     }
01340 
01341     /* Make sure the event is not present and get the next free slot. */
01342     thisindex = get_free_EventCodeIndex( ESI, ( unsigned int ) EventCode );
01343     if ( thisindex < PAPI_OK ) {
01344        return thisindex;
01345     }
01346 
01347     INTDBG("Adding event to slot %d of EventSet %d\n",thisindex,ESI->EventSetIndex);
01348 
01349     /* If it is a software MPX EventSet, add it to the multiplex data structure */
01350     /* and this thread's multiplex list                                         */
01351 
01352     if ( !_papi_hwi_is_sw_multiplex( ESI ) ) {
01353 
01354        /* Handle preset case */
01355        if ( IS_PRESET(EventCode) ) {
01356       int count;
01357       int preset_index = EventCode & ( int ) PAPI_PRESET_AND_MASK;
01358 
01359       /* Check if it's within the valid range */
01360       if ( ( preset_index < 0 ) || ( preset_index >= PAPI_MAX_PRESET_EVENTS ) ) {
01361          return PAPI_EINVAL;
01362       }
01363 
01364       /* count the number of native events in this preset */
01365       count = ( int ) _papi_hwi_presets[preset_index].count;
01366 
01367       /* Check if event exists */
01368       if ( !count ) {
01369          return PAPI_ENOEVNT;
01370       }
01371             
01372       /* check if the native events have been used as overflow events */
01373       /* this is not allowed                                          */
01374       if ( ESI->state & PAPI_OVERFLOWING ) {
01375          for( i = 0; i < count; i++ ) {
01376         for( j = 0; j < ESI->overflow.event_counter; j++ ) {
01377           if ( ESI->overflow.EventCode[j] ==(int)
01378             ( _papi_hwi_presets[preset_index].code[i] ) ) {
01379               return PAPI_ECNFLCT;
01380            }
01381         }
01382          }
01383       }
01384 
01385       /* Try to add the preset. */
01386 
01387       remap = add_native_events( ESI,
01388                      _papi_hwi_presets[preset_index].code,
01389                      count, &ESI->EventInfoArray[thisindex] );
01390       if ( remap < 0 ) {
01391          return remap;
01392       }
01393           else {
01394          /* Fill in the EventCode (machine independent) information */
01395          ESI->EventInfoArray[thisindex].event_code = 
01396                                   ( unsigned int ) EventCode;
01397          ESI->EventInfoArray[thisindex].derived =
01398                   _papi_hwi_presets[preset_index].derived_int;
01399          ESI->EventInfoArray[thisindex].ops =
01400                   _papi_hwi_presets[preset_index].postfix;
01401              ESI->NumberOfEvents++;
01402          _papi_hwi_map_events_to_native( ESI );
01403          
01404       }
01405        }
01406        /* Handle adding Native events */
01407        else if ( IS_NATIVE(EventCode) ) {
01408 
01409       /* Check if native event exists */
01410       if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) != PAPI_OK ) {
01411          return PAPI_ENOEVNT;
01412       }
01413             
01414       /* check if the native events have been used as overflow events */
01415       /* This is not allowed                                          */
01416       if ( ESI->state & PAPI_OVERFLOWING ) {
01417          for( j = 0; j < ESI->overflow.event_counter; j++ ) {
01418             if ( EventCode == ESI->overflow.EventCode[j] ) {
01419            return PAPI_ECNFLCT;
01420         }
01421          }
01422       }
01423 
01424       /* Try to add the native event. */
01425 
01426       remap = add_native_events( ESI, (unsigned int *)&EventCode, 1,
01427                      &ESI->EventInfoArray[thisindex] );
01428 
01429       if ( remap < 0 ) {
01430          return remap;
01431       } else {
01432 
01433          /* Fill in the EventCode (machine independent) information */
01434          ESI->EventInfoArray[thisindex].event_code = 
01435                                        ( unsigned int ) EventCode;
01436              ESI->NumberOfEvents++;
01437          _papi_hwi_map_events_to_native( ESI );
01438          
01439       }
01440        } else if ( IS_USER_DEFINED( EventCode ) ) {
01441          int count;
01442          int index = EventCode & PAPI_UE_AND_MASK;
01443 
01444          if ( index < 0 || index >= user_defined_events_count )
01445            return ( PAPI_EINVAL );
01446 
01447          count = ( int ) user_defined_events[index].count;
01448 
01449          for ( i = 0; i < count; i++ ) {
01450            for ( j = 0; j < ESI->overflow.event_counter; j++ ) {
01451              if ( ESI->overflow.EventCode[j] ==
01452                  (int)(user_defined_events[index].code[i]) ) {
01453                return ( PAPI_EBUG );
01454              }
01455            }
01456          }
01457 
01458          remap = add_native_events( ESI,
01459              user_defined_events[index].code,
01460              count, &ESI->EventInfoArray[thisindex] );
01461 
01462          if ( remap < 0 ) {
01463            return remap;
01464          } else {
01465            ESI->EventInfoArray[thisindex].event_code = (unsigned int) EventCode;
01466            ESI->EventInfoArray[thisindex].derived = user_defined_events[index].derived_int;
01467            ESI->EventInfoArray[thisindex].ops = user_defined_events[index].postfix;
01468            ESI->NumberOfEvents++;
01469            _papi_hwi_map_events_to_native( ESI );
01470          }
01471        } else {
01472 
01473       /* not Native, Preset, or User events */
01474 
01475       return PAPI_EBUG;
01476        }
01477     }
01478     else {
01479         
01480        /* Multiplexing is special. See multiplex.c */
01481 
01482        retval = mpx_add_event( &ESI->multiplex.mpx_evset, EventCode,
01483                    ESI->domain.domain, 
01484                    ESI->granularity.granularity );
01485 
01486 
01487        if ( retval < PAPI_OK ) {
01488       return retval;
01489        }
01490 
01491        /* Relevant (???) */
01492        ESI->EventInfoArray[thisindex].event_code = ( unsigned int ) EventCode;  
01493        ESI->EventInfoArray[thisindex].derived = NOT_DERIVED;
01494 
01495        ESI->NumberOfEvents++;
01496 
01497        /* event is in the EventInfoArray but not mapped to the NativeEvents */
01498        /* this causes issues if you try to set overflow on the event.       */
01499        /* in theory this wouldn't matter anyway.                            */
01500     }
01501 
01502     /* reinstate the overflows if any */
01503     retval=update_overflow( ESI );
01504 
01505     return retval;
01506 }

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

00742 {
00743    INTDBG("ENTER: ESI: %p (%d), cidx: %d\n", ESI, ESI->EventSetIndex, cidx);
00744    int retval;
00745    size_t max_counters;
00746    char *ptr;
00747    unsigned int i, j;
00748 
00749    /* If component doesn't exist... */
00750    if (_papi_hwi_invalid_cmp(cidx)) return PAPI_ECMP;
00751 
00752    /* Assigned at create time */
00753    ESI->domain.domain = _papi_hwd[cidx]->cmp_info.default_domain;
00754    ESI->granularity.granularity =
00755                              _papi_hwd[cidx]->cmp_info.default_granularity;
00756    ESI->CmpIdx = cidx;
00757 
00758    /* ??? */
00759    max_counters = ( size_t ) _papi_hwd[cidx]->cmp_info.num_mpx_cntrs;
00760 
00761    ESI->ctl_state = (hwd_control_state_t *) papi_calloc( 1, (size_t) 
00762                    _papi_hwd[cidx]->size.control_state );
00763    ESI->sw_stop = (long long *) papi_calloc( ( size_t ) max_counters,
00764                               sizeof ( long long ) );
00765    ESI->hw_start = ( long long * ) papi_calloc( ( size_t ) max_counters,
00766                                                       sizeof ( long long ) );
00767    ESI->EventInfoArray = ( EventInfo_t * ) papi_calloc( (size_t) max_counters,
00768                                                       sizeof ( EventInfo_t ) );
00769 
00770    /* allocate room for the native events and for the component-private */
00771    /* register structures */
00772    /* ugh is there a cleaner way to allocate this?  vmw */
00773    ESI->NativeInfoArray = ( NativeInfo_t * ) 
00774      papi_calloc( ( size_t ) max_counters, sizeof ( NativeInfo_t ));
00775 
00776    ESI->NativeBits = papi_calloc(( size_t ) max_counters,
00777                                  ( size_t ) _papi_hwd[cidx]->size.reg_value );
00778 
00779    /* NOTE: the next two malloc allocate blocks of memory that are later */
00780    /* parcelled into overflow and profile arrays                         */
00781    ESI->overflow.deadline = ( long long * )
00782         papi_malloc( ( sizeof ( long long ) +
00783                        sizeof ( int ) * 3 ) * ( size_t ) max_counters );
00784 
00785    ESI->profile.prof = ( PAPI_sprofil_t ** )
00786         papi_malloc( ( sizeof ( PAPI_sprofil_t * ) * ( size_t ) max_counters +
00787                        ( size_t ) max_counters * sizeof ( int ) * 4 ) );
00788 
00789    /* If any of these allocations failed, free things up and fail */
00790 
00791    if ( ( ESI->ctl_state == NULL ) ||
00792     ( ESI->sw_stop == NULL )   || 
00793         ( ESI->hw_start == NULL )  ||
00794     ( ESI->NativeInfoArray == NULL ) || 
00795     ( ESI->NativeBits == NULL ) || 
00796         ( ESI->EventInfoArray == NULL )  ||
00797     ( ESI->profile.prof == NULL ) || 
00798         ( ESI->overflow.deadline == NULL ) ) {
00799 
00800       if ( ESI->sw_stop ) papi_free( ESI->sw_stop );
00801       if ( ESI->hw_start ) papi_free( ESI->hw_start );
00802       if ( ESI->EventInfoArray ) papi_free( ESI->EventInfoArray );
00803       if ( ESI->NativeInfoArray ) papi_free( ESI->NativeInfoArray );
00804       if ( ESI->NativeBits ) papi_free( ESI->NativeBits );
00805       if ( ESI->ctl_state ) papi_free( ESI->ctl_state );
00806       if ( ESI->overflow.deadline ) papi_free( ESI->overflow.deadline );
00807       if ( ESI->profile.prof ) papi_free( ESI->profile.prof );
00808       papi_free( ESI );
00809       return PAPI_ENOMEM;
00810    }
00811 
00812 
00813    /* Carve up the overflow block into separate arrays */
00814    ptr = ( char * ) ESI->overflow.deadline;
00815    ptr += sizeof ( long long ) * max_counters;
00816    ESI->overflow.threshold = ( int * ) ptr;
00817    ptr += sizeof ( int ) * max_counters;
00818    ESI->overflow.EventIndex = ( int * ) ptr;
00819    ptr += sizeof ( int ) * max_counters;
00820    ESI->overflow.EventCode = ( int * ) ptr;
00821 
00822    /* Carve up the profile block into separate arrays */
00823    ptr = ( char * ) ESI->profile.prof +
00824         ( sizeof ( PAPI_sprofil_t * ) * max_counters );
00825    ESI->profile.count = ( int * ) ptr;
00826    ptr += sizeof ( int ) * max_counters;
00827    ESI->profile.threshold = ( int * ) ptr;
00828    ptr += sizeof ( int ) * max_counters;
00829    ESI->profile.EventIndex = ( int * ) ptr;
00830    ptr += sizeof ( int ) * max_counters;
00831    ESI->profile.EventCode = ( int * ) ptr;
00832 
00833    /* initialize_EventInfoArray */
00834 
00835    for ( i = 0; i < max_counters; i++ ) {
00836        ESI->EventInfoArray[i].event_code=( unsigned int ) PAPI_NULL;
00837        ESI->EventInfoArray[i].ops = NULL;
00838        ESI->EventInfoArray[i].derived=NOT_DERIVED;
00839        for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
00840        ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
00841        }
00842    }
00843 
00844    /* initialize_NativeInfoArray */
00845    for( i = 0; i < max_counters; i++ ) {
00846       ESI->NativeInfoArray[i].ni_event = -1;
00847       ESI->NativeInfoArray[i].ni_position = -1;
00848       ESI->NativeInfoArray[i].ni_papi_code = -1;
00849       ESI->NativeInfoArray[i].ni_owners = 0;
00850       ESI->NativeInfoArray[i].ni_bits = ((unsigned char*)ESI->NativeBits) + 
00851                                           (i*_papi_hwd[cidx]->size.reg_value);
00852    }
00853 
00854    ESI->NativeCount = 0;
00855 
00856    ESI->state = PAPI_STOPPED;
00857 
00858    /* these used to be init_config */
00859    retval = _papi_hwd[cidx]->init_control_state( ESI->ctl_state );  
00860    retval |= _papi_hwd[cidx]->set_domain( ESI->ctl_state, ESI->domain.domain);
00861 
00862    return retval;
00863 }

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

01731 {
01732    int i, j, num_cntrs, retval;
01733    hwd_context_t *context;
01734    int EventCode;
01735    NativeInfo_t *native;
01736    if ( !_papi_hwi_invalid_cmp( ESI->CmpIdx ) ) {
01737    num_cntrs = _papi_hwd[ESI->CmpIdx]->cmp_info.num_mpx_cntrs;
01738 
01739    for(i=0;i<num_cntrs;i++) {
01740 
01741       EventCode=ESI->EventInfoArray[i].event_code;     
01742 
01743       /* skip if event not there */
01744       if ( EventCode == PAPI_NULL ) continue;
01745 
01746       /* If it is a MPX EventSet, remove it from the multiplex */
01747       /* data structure and this thread's multiplex list */
01748 
01749       if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
01750      retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
01751      if ( retval < PAPI_OK )
01752         return retval;
01753       } else {
01754 
01755       native = ESI->NativeInfoArray;
01756 
01757       /* clear out ESI->NativeInfoArray */
01758       /* do we really need to do this, seeing as we free() it later? */
01759 
01760       for( j = 0; j < ESI->NativeCount; j++ ) {
01761          native[j].ni_event = -1;
01762          native[j].ni_position = -1;
01763          native[j].ni_owners = 0;
01764          /* native[j].ni_bits?? */
01765       }
01766       }
01767 
01768       /* do we really need to do this, seeing as we free() it later? */
01769       ESI->EventInfoArray[i].event_code= ( unsigned int ) PAPI_NULL;
01770       for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
01771       ESI->EventInfoArray[i].pos[j] = PAPI_NULL;
01772       }
01773       ESI->EventInfoArray[i].ops = NULL;
01774       ESI->EventInfoArray[i].derived = NOT_DERIVED;
01775    }
01776 
01777    context = _papi_hwi_get_context( ESI, NULL );
01778    /* calling with count of 0 equals a close? */
01779    retval = _papi_hwd[ESI->CmpIdx]->update_control_state( ESI->ctl_state,
01780                    NULL, 0, context);
01781    if (retval!=PAPI_OK) {
01782      return retval;
01783    }
01784    }
01785 
01786    ESI->CmpIdx = -1;
01787    ESI->NumberOfEvents = 0;
01788    ESI->NativeCount = 0;
01789 
01790    if ( ( ESI->state & PAPI_MULTIPLEXING ) && ESI->multiplex.mpx_evset )
01791            papi_free( ESI->multiplex.mpx_evset );
01792 
01793    if ( ( ESI->state & PAPI_CPU_ATTACH ) && ESI->CpuInfo )
01794            _papi_hwi_shutdown_cpu( ESI->CpuInfo );
01795 
01796    if ( ESI->ctl_state )
01797       papi_free( ESI->ctl_state );
01798 
01799    if ( ESI->sw_stop )
01800       papi_free( ESI->sw_stop );
01801 
01802    if ( ESI->hw_start )
01803       papi_free( ESI->hw_start );
01804     
01805    if ( ESI->EventInfoArray )
01806       papi_free( ESI->EventInfoArray );
01807     
01808    if ( ESI->NativeInfoArray ) 
01809       papi_free( ESI->NativeInfoArray );
01810 
01811    if ( ESI->NativeBits ) 
01812       papi_free( ESI->NativeBits );
01813     
01814    if ( ESI->overflow.deadline )
01815       papi_free( ESI->overflow.deadline );
01816     
01817    if ( ESI->profile.prof )
01818       papi_free( ESI->profile.prof );
01819 
01820    ESI->ctl_state = NULL;
01821    ESI->sw_stop = NULL;
01822    ESI->hw_start = NULL;
01823    ESI->EventInfoArray = NULL;
01824    ESI->NativeInfoArray = NULL;
01825    ESI->NativeBits = NULL;
01826 
01827    memset( &ESI->domain, 0x0, sizeof(EventSetDomainInfo_t) );
01828    memset( &ESI->granularity, 0x0, sizeof(EventSetGranularityInfo_t) );
01829    memset( &ESI->overflow, 0x0, sizeof(EventSetOverflowInfo_t) );
01830    memset( &ESI->multiplex, 0x0, sizeof(EventSetMultiplexInfo_t) );
01831    memset( &ESI->attach, 0x0, sizeof(EventSetAttachInfo_t) );
01832    memset( &ESI->cpu, 0x0, sizeof(EventSetCpuInfo_t) );
01833    memset( &ESI->profile, 0x0, sizeof(EventSetProfileInfo_t) );
01834    memset( &ESI->inherit, 0x0, sizeof(EventSetInheritInfo_t) );
01835 
01836    ESI->CpuInfo = NULL;
01837 
01838    return PAPI_OK;
01839 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_component_index ( int  event_code  ) 

Definition at line 515 of file papi_internal.c.

00515                                             {
00516     INTDBG("ENTER: event_code: %#x\n", event_code);
00517 
00518   int cidx;
00519   int event_index;
00520 
00521   /* currently assume presets are for component 0 only */
00522   if (IS_PRESET(event_code)) {
00523      INTDBG("EXIT: Event %#x is a PRESET, assigning component %d\n", event_code,0);
00524      return 0;
00525   }
00526 
00527   /* user defined events are treated like preset events (component 0 only) */
00528   if (IS_USER_DEFINED(event_code)) {
00529      INTDBG("EXIT: Event %#x is USER DEFINED, assigning component %d\n", event_code,0);
00530      return 0;
00531   }
00532 
00533   event_index=event_code&PAPI_NATIVE_AND_MASK;
00534 
00535   if ( (event_index < 0) || (event_index>=num_native_events)) {
00536      INTDBG("EXIT: Event index %#x is out of range, num_native_events: %d\n", event_index, num_native_events);
00537      return PAPI_ENOEVNT;
00538   }
00539 
00540   cidx=_papi_native_events[event_index].cidx;
00541 
00542   if ((cidx<0) || (cidx >= papi_num_components)) {
00543       INTDBG("EXIT: Component index %#x is out of range, papi_num_components: %d\n", cidx, papi_num_components);
00544       return PAPI_ENOCMP;
00545   }
00546 
00547   INTDBG("EXIT: Found cidx: %d event_index: %d, event_code: %#x\n", cidx, event_index, event_code);
00548   return cidx;
00549 }

Here is the caller graph for this function:

int _papi_hwi_convert_eventset_to_multiplex ( _papi_int_multiplex_t mpx  ) 

Definition at line 1842 of file papi_internal.c.

01843 {
01844     int retval, i, j = 0, *mpxlist = NULL;
01845     EventSetInfo_t *ESI = mpx->ESI;
01846     int flags = mpx->flags;
01847 
01848     /* If there are any events in the EventSet, 
01849        convert them to multiplex events */
01850 
01851     if ( ESI->NumberOfEvents ) {
01852 
01853         mpxlist =
01854             ( int * ) papi_malloc( sizeof ( int ) *
01855                                    ( size_t ) ESI->NumberOfEvents );
01856         if ( mpxlist == NULL )
01857             return ( PAPI_ENOMEM );
01858 
01859         /* Build the args to MPX_add_events(). */
01860 
01861         /* Remember the EventInfoArray can be sparse
01862            and the data can be non-contiguous */
01863 
01864         for ( i = 0; i < EventInfoArrayLength( ESI ); i++ )
01865             if ( ESI->EventInfoArray[i].event_code !=
01866                  ( unsigned int ) PAPI_NULL )
01867                 mpxlist[j++] = ( int ) ESI->EventInfoArray[i].event_code;
01868 
01869         /* Resize the EventInfo_t array */
01870 
01871         if ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex == 0 ) ||
01872              ( ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) &&
01873                ( flags & PAPI_MULTIPLEX_FORCE_SW ) ) ) {
01874             retval =
01875                 MPX_add_events( &ESI->multiplex.mpx_evset, mpxlist, j,
01876                                 ESI->domain.domain,
01877                                 ESI->granularity.granularity );
01878             if ( retval != PAPI_OK ) {
01879                 papi_free( mpxlist );
01880                 return ( retval );
01881             }
01882         }
01883 
01884         papi_free( mpxlist );
01885     }
01886 
01887     /* Update the state before initialization! */
01888 
01889     ESI->state |= PAPI_MULTIPLEXING;
01890     if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex &&
01891          ( flags & PAPI_MULTIPLEX_FORCE_SW ) )
01892         ESI->multiplex.flags = PAPI_MULTIPLEX_FORCE_SW;
01893     ESI->multiplex.ns = ( int ) mpx->ns;
01894 
01895     return ( PAPI_OK );
01896 }

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

00919 {
00920     EventSetInfo_t *ESI;
00921     int retval;
00922 
00923     /* Is the EventSet already in existence? */
00924 
00925     if ( ( EventSet == NULL ) || ( handle == NULL ) )
00926         return PAPI_EINVAL;
00927 
00928     if ( *EventSet != PAPI_NULL )
00929         return PAPI_EINVAL;
00930 
00931     /* Well, then allocate a new one. Use n to keep track of a NEW EventSet */
00932 
00933     retval = create_EventSet( &ESI );
00934     if ( retval != PAPI_OK )
00935         return retval;
00936 
00937     ESI->CmpIdx = -1;        /* when eventset is created, it is not decided yet which component it belongs to, until first event is added */
00938     ESI->state = PAPI_STOPPED;
00939 
00940     /* Add it to the global table */
00941 
00942     retval = add_EventSet( ESI, handle );
00943     if ( retval < PAPI_OK ) {
00944         _papi_hwi_free_EventSet( ESI );
00945         return retval ;
00946     }
00947 
00948     *EventSet = ESI->EventSetIndex;
00949 
00950     INTDBG( "(%p,%p): new EventSet in slot %d\n",
00951             ( void * ) EventSet, handle, *EventSet );
00952 
00953     return retval;
00954 }

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

02206 {
02207   int i = 0;
02208   while ( _papi_hwi_derived[i].name != NULL ) {
02209     if ( strcasecmp( tmp, _papi_hwi_derived[i].name ) == 0 ) {
02210       *code = _papi_hwi_derived[i].value;
02211       return PAPI_OK;
02212     }
02213     i++;
02214   }
02215   INTDBG( "Invalid derived string %s\n", tmp );
02216   return PAPI_EINVAL;
02217 }

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

02001 {
02002     /* This function is not used and shouldn't be called. */
02003     ( void ) EventSet;       /*unused */
02004     ( void ) address;        /*unused */
02005     ( void ) overflow_vector;   /*unused */
02006     ( void ) context;        /*unused */
02007     return;
02008 }

Here is the caller graph for this function:

int _papi_hwi_eventcode_to_native ( int  event_code  ) 

Definition at line 576 of file papi_internal.c.

00576                                               {
00577     INTDBG("ENTER: event_code: %#x\n", event_code);
00578 
00579   int result;
00580   int event_index;
00581 
00582   event_index=event_code&PAPI_NATIVE_AND_MASK;
00583  if ((event_index < 0)  ||  (event_index>=num_native_events)) {
00584     INTDBG("EXIT: PAPI_ENOEVNT\n");
00585     return PAPI_ENOEVNT;
00586   }
00587 
00588   result=_papi_native_events[event_index].component_event;
00589   
00590   INTDBG("EXIT: result: %#x\n", result);
00591   return result;
00592 
00593 }

Here is the caller graph for this function:

void _papi_hwi_free_EventSet ( EventSetInfo_t ESI  ) 

Definition at line 873 of file papi_internal.c.

00874 {
00875     _papi_hwi_cleanup_eventset( ESI );
00876 
00877 #ifdef DEBUG
00878     memset( ESI, 0x00, sizeof ( EventSetInfo_t ) );
00879 #endif
00880     papi_free( ESI );
00881 
00882 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_free_papi_event_string (  ) 

Definition at line 107 of file papi_internal.c.

00107                                    {
00108     if (papi_event_string != NULL) {
00109         free(papi_event_string);
00110         papi_event_string = NULL;
00111     }
00112     return;
00113 }

Here is the caller graph for this function:

hwd_context_t* _papi_hwi_get_context ( EventSetInfo_t ESI,
int *  is_dirty 
)

Definition at line 2649 of file papi_internal.c.

02650 {
02651     INTDBG("Entry: ESI: %p, is_dirty: %p\n", ESI, is_dirty);
02652     int dirty_ctx;
02653     hwd_context_t *ctx=NULL;
02654 
02655     /* assume for now the control state is clean (last updated by this ESI) */
02656     dirty_ctx = 0;
02657     
02658     /* get a context pointer based on if we are counting for a thread or for a cpu */
02659     if (ESI->state & PAPI_CPU_ATTACHED) {
02660         /* use cpu context */
02661         ctx = ESI->CpuInfo->context[ESI->CmpIdx];
02662 
02663         /* if the user wants to know if the control state was last set by the same event set, tell him */
02664         if (is_dirty != NULL) {
02665             if (ESI->CpuInfo->from_esi != ESI) {
02666                 dirty_ctx = 1;
02667             }
02668             *is_dirty = dirty_ctx;
02669         }
02670         ESI->CpuInfo->from_esi = ESI;
02671        
02672     } else {
02673 
02674         /* use thread context */
02675         ctx = ESI->master->context[ESI->CmpIdx];
02676 
02677         /* if the user wants to know if the control state was last set by the same event set, tell him */
02678         if (is_dirty != NULL) {
02679             if (ESI->master->from_esi != ESI) {
02680                 dirty_ctx = 1;
02681             }
02682             *is_dirty = dirty_ctx;
02683         }
02684         ESI->master->from_esi = ESI;
02685 
02686     }
02687     return( ctx );
02688 }

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

02534 {
02535       INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
02536     int retval;
02537     int cidx;
02538     int nevt_code;
02539 
02540     cidx = _papi_hwi_component_index( EventCode );
02541     if (cidx<0) return PAPI_ENOCMP;
02542 
02543     if (_papi_hwd[cidx]->cmp_info.disabled) return PAPI_ENOCMP;
02544 
02545     if ( EventCode & PAPI_NATIVE_MASK ) {
02546         // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
02547         _papi_hwi_set_papi_event_code(EventCode, 0);
02548 
02549        /* clear the event info */
02550        memset( info, 0, sizeof ( PAPI_event_info_t ) );
02551        info->event_code = ( unsigned int ) EventCode;
02552        info->component_index = (unsigned int) cidx;
02553        retval = _papi_hwd[cidx]->ntv_code_to_info( 
02554                   _papi_hwi_eventcode_to_native(EventCode), info);
02555 
02556        /* If component error, it's missing the ntv_code_to_info vector */
02557        /* so we'll have to fake it.                                    */
02558        if ( retval == PAPI_ECMP ) {
02559 
02560 
02561       INTDBG("missing NTV_CODE_TO_INFO, faking\n");
02562       /* Fill in the info structure */
02563 
02564         if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
02565             INTDBG("EXIT: nevt_code: %d\n", nevt_code);
02566             return nevt_code;
02567         }
02568       if ( (retval = _papi_hwd[cidx]->ntv_code_to_name( 
02569                     (unsigned int)nevt_code,
02570                     info->symbol,
02571                     sizeof(info->symbol)) ) == PAPI_OK ) {
02572 
02573       } else {
02574          INTDBG("EXIT: retval: %d\n", retval);
02575          return retval;
02576       }
02577 
02578         if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) <0) {
02579             INTDBG("EXIT: nevt_code: %d\n", nevt_code);
02580             return nevt_code;
02581         }
02582       retval = _papi_hwd[cidx]->ntv_code_to_descr( 
02583                      (unsigned int)nevt_code,
02584                      info->long_descr,
02585                      sizeof ( info->long_descr));
02586       if (retval!=PAPI_OK) {
02587          INTDBG("Failed ntv_code_to_descr()\n");
02588       }
02589 
02590        }
02591        retval = _papi_hwi_prefix_component_name( 
02592                         _papi_hwd[cidx]->cmp_info.short_name, 
02593                         info->symbol,
02594                         info->symbol, 
02595                         sizeof(info->symbol) );
02596 
02597        INTDBG("EXIT: retval: %d\n", retval);
02598        return retval;
02599     }
02600 
02601     INTDBG("EXIT: PAPI_ENOEVNT\n");
02602     return PAPI_ENOEVNT;
02603 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_ntv_idx ( unsigned int  papi_evt_code  ) 

Definition at line 142 of file papi_internal.c.

00142                                                    {
00143     INTDBG("ENTER: papi_evt_code: %#x\n", papi_evt_code);
00144 
00145     int result;
00146     int event_index;
00147 
00148     if (papi_evt_code == 0) {
00149         INTDBG("EXIT: PAPI_ENOEVNT, invalid papi event code\n");
00150         return PAPI_ENOEVNT;
00151     }
00152 
00153     event_index=papi_evt_code&PAPI_NATIVE_AND_MASK;
00154     if ((event_index<0) || (event_index>=num_native_events)) {
00155         INTDBG("EXIT: PAPI_ENOEVNT, invalid index into native event array\n");
00156         return PAPI_ENOEVNT;
00157     }
00158 
00159     result=_papi_native_events[event_index].ntv_idx;
00160 
00161     INTDBG("EXIT: result: %d\n", result);
00162     return result;
00163 }

Here is the caller graph for this function:

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

Definition at line 136 of file papi_internal.c.

00136                                  {
00137     INTDBG("papi_event_code: %#x\n", papi_event_code);
00138     return papi_event_code;
00139 }

Here is the caller graph for this function:

char* _papi_hwi_get_papi_event_string ( void   ) 

Definition at line 102 of file papi_internal.c.

00102                                    {
00103     INTDBG("papi_event_string: %s\n", papi_event_string);
00104     return papi_event_string;
00105 }

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

02250 {
02251     INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
02252 
02253     int i = EventCode & PAPI_PRESET_AND_MASK;
02254     unsigned int j;
02255 
02256     if ( _papi_hwi_presets[i].symbol ) {    /* if the event is in the preset table */
02257       // since we are setting the whole structure to zero the strncpy calls below will 
02258       // be leaving NULL terminates strings as long as they copy 1 less byte than the 
02259       // buffer size of the field.
02260        memset( info, 0, sizeof ( PAPI_event_info_t ) );
02261 
02262        info->event_code = ( unsigned int ) EventCode;
02263        strncpy( info->symbol, _papi_hwi_presets[i].symbol,
02264         sizeof(info->symbol)-1);
02265 
02266        if ( _papi_hwi_presets[i].short_descr != NULL )
02267           strncpy( info->short_descr, _papi_hwi_presets[i].short_descr,
02268                   sizeof ( info->short_descr )-1 );
02269 
02270        if ( _papi_hwi_presets[i].long_descr != NULL )
02271           strncpy( info->long_descr,  _papi_hwi_presets[i].long_descr,
02272                   sizeof ( info->long_descr )-1 );
02273 
02274        info->event_type = _papi_hwi_presets[i].event_type;
02275        info->count = _papi_hwi_presets[i].count;
02276 
02277        _papi_hwi_derived_string( _papi_hwi_presets[i].derived_int,
02278                      info->derived,  sizeof ( info->derived ) );
02279 
02280        if ( _papi_hwi_presets[i].postfix != NULL )
02281           strncpy( info->postfix, _papi_hwi_presets[i].postfix,
02282                   sizeof ( info->postfix )-1 );
02283 
02284        for(j=0;j < info->count; j++) {
02285           info->code[j]=_papi_hwi_presets[i].code[j];
02286           strncpy(info->name[j], _papi_hwi_presets[i].name[j],
02287           sizeof(info->name[j])-1);
02288        }
02289 
02290        if ( _papi_hwi_presets[i].note != NULL ) {
02291           strncpy( info->note, _papi_hwi_presets[i].note,
02292                   sizeof ( info->note )-1 );
02293        }
02294 
02295        return PAPI_OK;
02296     } else {
02297        return PAPI_ENOEVNT;
02298     }
02299 }

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

02310 {
02311     INTDBG("ENTER: EventCode: %#x, info: %p\n", EventCode, info);
02312 
02313     unsigned int i = EventCode & PAPI_UE_AND_MASK;
02314     unsigned int j;
02315 
02316     // if event code not in valid range, return error
02317     if (i >= PAPI_MAX_USER_EVENTS) {
02318         INTDBG("EXIT: Invalid event index: %d, max value is: %d\n", i, PAPI_MAX_USER_EVENTS - 1);
02319         return( PAPI_ENOEVNT );
02320     }
02321 
02322     if ( user_defined_events[i].symbol == NULL) {   /* if the event is in the preset table */
02323         INTDBG("EXIT: Event symbol for this event is NULL\n");
02324         return PAPI_ENOEVNT;
02325     }
02326 
02327     /* set whole structure to 0 */
02328     memset( info, 0, sizeof ( PAPI_event_info_t ) );
02329 
02330     info->event_code = ( unsigned int ) EventCode;
02331     strncpy( info->symbol, user_defined_events[i].symbol,
02332         sizeof(info->symbol)-1);
02333 
02334     if ( user_defined_events[i].short_descr != NULL )
02335         strncpy( info->short_descr, user_defined_events[i].short_descr,
02336             sizeof(info->short_descr)-1);
02337 
02338     if ( user_defined_events[i].long_descr != NULL )
02339         strncpy( info->long_descr,  user_defined_events[i].long_descr,
02340             sizeof(info->long_descr)-1);
02341 
02342 //  info->event_type = user_defined_events[i].event_type;
02343     info->count = user_defined_events[i].count;
02344 
02345     _papi_hwi_derived_string( user_defined_events[i].derived_int,
02346             info->derived,  sizeof(info->derived)-1);
02347 
02348     if ( user_defined_events[i].postfix != NULL )
02349         strncpy( info->postfix, user_defined_events[i].postfix,
02350             sizeof(info->postfix)-1);
02351 
02352     for(j=0;j < info->count; j++) {
02353         info->code[j]=user_defined_events[i].code[j];
02354         INTDBG("info->code[%d]: %#x\n", j, info->code[j]);
02355         strncpy(info->name[j], user_defined_events[i].name[j], sizeof(info->name[j])-1);
02356     }
02357 
02358     if ( user_defined_events[i].note != NULL ) {
02359         strncpy( info->note, user_defined_events[i].note, sizeof(info->note)-1);
02360     }
02361 
02362     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);
02363     return PAPI_OK;
02364 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_init_errors ( void   ) 

Definition at line 478 of file papi_internal.c.

00478                             {
00479 /* we use add error to avoid the cost of lookups, we know the errors are not there yet */
00480     _papi_hwi_add_error("No error");
00481     _papi_hwi_add_error("Invalid argument");
00482     _papi_hwi_add_error("Insufficient memory");
00483     _papi_hwi_add_error("A System/C library call failed");
00484     _papi_hwi_add_error("Not supported by component");
00485     _papi_hwi_add_error("Access to the counters was lost or interrupted");
00486     _papi_hwi_add_error("Internal error, please send mail to the developers");
00487     _papi_hwi_add_error("Event does not exist");
00488     _papi_hwi_add_error("Event exists, but cannot be counted due to hardware resource limits");
00489     _papi_hwi_add_error("EventSet is currently not running");
00490     _papi_hwi_add_error("EventSet is currently counting");
00491     _papi_hwi_add_error("No such EventSet available");
00492     _papi_hwi_add_error("Event in argument is not a valid preset");
00493     _papi_hwi_add_error("Hardware does not support performance counters");
00494     _papi_hwi_add_error("Unknown error code");
00495     _papi_hwi_add_error("Permission level does not permit operation");
00496     _papi_hwi_add_error("PAPI hasn't been initialized yet");
00497     _papi_hwi_add_error("Component Index isn't set");
00498     _papi_hwi_add_error("Not supported");
00499     _papi_hwi_add_error("Not implemented");
00500     _papi_hwi_add_error("Buffer size exceeded");
00501     _papi_hwi_add_error("EventSet domain is not supported for the operation");
00502     _papi_hwi_add_error("Invalid or missing event attributes");
00503     _papi_hwi_add_error("Too many events or attributes");
00504     _papi_hwi_add_error("Bad combination of features");
00505 }

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

01909 {
01910         int retval, i = 0;
01911 
01912     retval = _papi_hwi_innoculate_os_vector( &_papi_os_vector );
01913     if ( retval != PAPI_OK ) {
01914        return retval;
01915     }
01916 
01917     while ( _papi_hwd[i] ) {
01918 
01919        retval = _papi_hwi_innoculate_vector( _papi_hwd[i] );
01920        if ( retval != PAPI_OK ) {
01921           return retval;
01922        }
01923 
01924        /* We can be disabled by user before init */
01925        if (!_papi_hwd[i]->cmp_info.disabled) {
01926           retval = _papi_hwd[i]->init_component( i );
01927           _papi_hwd[i]->cmp_info.disabled=retval;
01928 
01929           /* Do some sanity checking */
01930           if (retval==PAPI_OK) {
01931         if (_papi_hwd[i]->cmp_info.num_cntrs >
01932             _papi_hwd[i]->cmp_info.num_mpx_cntrs) {
01933           fprintf(stderr,"Warning!  num_cntrs %d is more than num_mpx_cntrs %d for component %s\n",
01934                         _papi_hwd[i]->cmp_info.num_cntrs,
01935                         _papi_hwd[i]->cmp_info.num_mpx_cntrs,
01936                         _papi_hwd[i]->cmp_info.name);
01937         }
01938 
01939           }
01940        }
01941 
01942        i++;
01943     }
01944     return PAPI_OK;
01945 }

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

01952 {
01953 
01954     int retval;
01955 
01956     memset(&_papi_hwi_system_info,0x0,sizeof( _papi_hwi_system_info ));
01957 
01958     memset( _papi_hwi_using_signal,0x0,sizeof( _papi_hwi_using_signal ));
01959 
01960     /* Global struct to maintain EventSet mapping */
01961     retval = allocate_eventset_map( &_papi_hwi_system_info.global_eventset_map );
01962     if ( retval != PAPI_OK ) {
01963         return retval;
01964     }
01965 
01966     _papi_hwi_system_info.pid = 0;  /* Process identifier */
01967 
01968     /* PAPI_hw_info_t struct */
01969     memset(&(_papi_hwi_system_info.hw_info),0x0,sizeof(PAPI_hw_info_t));
01970 
01971     return PAPI_OK;
01972 }

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.

01213                         {
01214   
01215    struct utsname uname_buffer;
01216 
01217    uname(&uname_buffer);
01218 
01219    strncpy(_papi_os_info.name,uname_buffer.sysname,PAPI_MAX_STR_LEN);
01220 
01221    strncpy(_papi_os_info.version,uname_buffer.release,PAPI_MAX_STR_LEN);
01222    
01223    _papi_os_info.itimer_sig = PAPI_INT_MPX_SIGNAL;
01224    _papi_os_info.itimer_num = PAPI_INT_ITIMER;
01225    _papi_os_info.itimer_res_ns = 1;
01226    _papi_os_info.itimer_ns = 1000 * PAPI_INT_MPX_DEF_US;
01227 
01228    return PAPI_OK;
01229 
01230 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_invalid_cmp ( int  cidx  ) 

Definition at line 508 of file papi_internal.c.

00509 {
00510   return ( cidx < 0 || cidx >= papi_num_components );
00511 }

Here is the caller graph for this function:

int _papi_hwi_is_sw_multiplex ( EventSetInfo_t ESI  ) 

Definition at line 2625 of file papi_internal.c.

02626 {
02627    /* Are we multiplexing at all */
02628    if ( ( ESI->state & PAPI_MULTIPLEXING ) == 0 ) {
02629       return 0;
02630    }
02631 
02632    /* Does the component support kernel multiplexing */
02633    if ( _papi_hwd[ESI->CmpIdx]->cmp_info.kernel_multiplex ) {
02634       /* Have we forced software multiplexing */
02635       if ( ESI->multiplex.flags == PAPI_MULTIPLEX_FORCE_SW ) {
02636      return 1;
02637       }
02638       /* Nope, using hardware multiplexing */
02639       return 0;
02640    } 
02641 
02642    /* We are multiplexing but the component does not support hardware */
02643 
02644    return 1;
02645 
02646 }

Here is the caller graph for this function:

int _papi_hwi_lookup_EventCodeIndex ( const EventSetInfo_t ESI,
unsigned int  EventCode 
)

Definition at line 986 of file papi_internal.c.

00988 {
00989     int i;
00990     int limit = EventInfoArrayLength( ESI );
00991 
00992     for ( i = 0; i < limit; i++ ) {
00993        if ( ESI->EventInfoArray[i].event_code == EventCode ) {
00994           return i;
00995        }
00996     }
00997 
00998     return PAPI_EINVAL;
00999 }

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

02607 {
02608     const DynamicArray_t *map = &_papi_hwi_system_info.global_eventset_map;
02609     EventSetInfo_t *set;
02610 
02611     if ( ( eventset < 0 ) || ( eventset > map->totalSlots ) )
02612         return ( NULL );
02613 
02614     set = map->dataSlotArray[eventset];
02615 #ifdef DEBUG
02616     if ( ( ISLEVEL( DEBUG_THREADS ) ) && ( _papi_hwi_thread_id_fn ) &&
02617          ( set->master->tid != _papi_hwi_thread_id_fn(  ) ) )
02618         return ( NULL );
02619 #endif
02620 
02621     return ( set );
02622 }

Here is the caller graph for this function:

void _papi_hwi_map_events_to_native ( EventSetInfo_t ESI  ) 

Definition at line 1066 of file papi_internal.c.

01067 {
01068     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);
01069 
01070     int i, event, k, n, preset_index = 0, nevt;
01071     int total_events = ESI->NumberOfEvents;
01072 
01073     event = 0;
01074     for( i = 0; i < total_events; i++ ) {
01075 
01076         /* find the first event that isn't PAPI_NULL */
01077         /* Is this really necessary? --vmw           */
01078         while ( ESI->EventInfoArray[event].event_code == ( unsigned int ) PAPI_NULL ) {
01079             event++;
01080         }
01081 
01082         /* If it's a preset */
01083         if ( IS_PRESET(ESI->EventInfoArray[event].event_code) ) {
01084             preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_PRESET_AND_MASK;
01085 
01086             /* walk all sub-events in the preset */
01087             for( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
01088                 nevt = _papi_hwi_presets[preset_index].code[k];
01089                 if ( nevt == PAPI_NULL ) {
01090                     break;
01091                 }
01092 
01093                 INTDBG("Looking for subevent %#x\n",nevt);
01094 
01095                 /* Match each sub-event to something in the Native List */
01096                 for( n = 0; n < ESI->NativeCount; n++ ) {
01097                     if ( nevt == ESI->NativeInfoArray[n].ni_papi_code ) {
01098                         INTDBG("Found papi event: %#x, &ESI->NativeInfoArray[%d]: %p, ni_event: %#x, ni_position %d\n",
01099                                 nevt, n, &(ESI->NativeInfoArray[n]), ESI->NativeInfoArray[n].ni_event, ESI->NativeInfoArray[n].ni_position);
01100                         ESI->EventInfoArray[event].pos[k] = ESI->NativeInfoArray[n].ni_position;
01101                         break;
01102                     }
01103                 }
01104             }
01105         }
01106         /* If it's a native event */
01107         else if( IS_NATIVE(ESI->EventInfoArray[event].event_code) ) {
01108             nevt = ( int ) ESI->EventInfoArray[event].event_code;
01109 
01110             // get index into native info array for this event
01111             int nidx = event_already_in_eventset( ESI, nevt );
01112             // if not found, then we need to return an error
01113             if (nidx == PAPI_ENOEVNT) {
01114                 INTDBG("EXIT: needed event not found\n");
01115                 return;
01116             }
01117             ESI->EventInfoArray[event].pos[0] = ESI->NativeInfoArray[nidx].ni_position;
01118             INTDBG("nidx: %d, ni_position: %d\n", nidx, ESI->NativeInfoArray[nidx].ni_position);
01119 
01120         }
01121         /* If it's a user-defined event */
01122         else if ( IS_USER_DEFINED(ESI->EventInfoArray[event].event_code) ) {
01123             preset_index = ( int ) ESI->EventInfoArray[event].event_code & PAPI_UE_AND_MASK;
01124             for ( k = 0; k < PAPI_EVENTS_IN_DERIVED_EVENT; k++ ) {
01125                 nevt = user_defined_events[preset_index].code[k];
01126                 INTDBG("nevt: %#x, user_defined_events[%d].code[%d]: %#x, code[%d]: %#x\n",
01127                         nevt, preset_index, k, user_defined_events[preset_index].code[k], k+1, user_defined_events[preset_index].code[k+1]);
01128 
01129                 if ( nevt == PAPI_NULL ) break;
01130 
01131                 /* Match each sub-event to something in the Native List */
01132                 for ( n = 0; n < ESI->NativeCount; n++ ) {
01133                     // if this is the event we are looking for, set its position and exit inner loop to look for next sub-event
01134                     if ( _papi_hwi_eventcode_to_native(nevt) == ESI->NativeInfoArray[n].ni_event ) {
01135                         ESI->EventInfoArray[event].pos[k] = ESI->NativeInfoArray[n].ni_position;
01136                         break;
01137                     }
01138                 }
01139             }
01140         }
01141         event++;
01142     }
01143     INTDBG("EXIT: \n");
01144     return;
01145 }

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

02496 {
02497     INTDBG("ENTER: EventCode: %#x, hwi_name: %p, len: %d\n", EventCode, hwi_name, len);
02498   int cidx;
02499   int retval; 
02500   int nevt_code;
02501 
02502   cidx = _papi_hwi_component_index( EventCode );
02503   if (cidx<0) return PAPI_ENOEVNT;
02504 
02505   if ( EventCode & PAPI_NATIVE_MASK ) {
02506       // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
02507       _papi_hwi_set_papi_event_code(EventCode, 0);
02508 
02509     if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
02510         INTDBG("EXIT: nevt_code: %d\n", nevt_code);
02511         return nevt_code;
02512     }
02513     if ( (retval = _papi_hwd[cidx]->ntv_code_to_name( 
02514                         (unsigned int)nevt_code,
02515                         hwi_name, len) ) == PAPI_OK ) {
02516             retval = _papi_hwi_prefix_component_name( _papi_hwd[cidx]->cmp_info.short_name, 
02517                                              hwi_name, hwi_name, len);
02518             INTDBG("EXIT: retval: %d\n", retval);
02519             return retval;
02520     }
02521     INTDBG("EXIT: retval: %d\n", retval);
02522     return (retval);
02523   }
02524   INTDBG("EXIT: PAPI_ENOEVNT\n");
02525   return PAPI_ENOEVNT;
02526 }

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

02402 {
02403     INTDBG("ENTER: in: %s, out: %p\n", in, out);
02404 
02405     int retval = PAPI_ENOEVNT;
02406     char name[PAPI_HUGE_STR_LEN];      /* make sure it's big enough */
02407     unsigned int i;
02408     int cidx;
02409     char *full_event_name;
02410 
02411     if (in == NULL) {
02412         INTDBG("EXIT: PAPI_EINVAL\n");
02413         return PAPI_EINVAL;
02414     }
02415 
02416     full_event_name = strdup(in);
02417 
02418     in = _papi_hwi_strip_component_prefix(in);
02419 
02420     // look in each component
02421     for(cidx=0; cidx < papi_num_components; cidx++) {
02422 
02423        if (_papi_hwd[cidx]->cmp_info.disabled) continue;
02424 
02425        // if this component does not support the pmu which defines this event, no need to call it
02426        if (is_supported_by_component(cidx, full_event_name) == 0) continue;
02427 
02428        INTDBG("cidx: %d, name: %s, event: %s\n", cidx, _papi_hwd[cidx]->cmp_info.name, in);
02429 
02430        // show that we do not have an event code yet (the component may create one and update this info)
02431        // this also clears any values left over from a previous call
02432        _papi_hwi_set_papi_event_code(-1, -1);
02433 
02434 
02435         // if component has a ntv_name_to_code function, use it to get event code
02436         if (_papi_hwd[cidx]->ntv_name_to_code != NULL) {
02437             // try and get this events event code
02438             retval = _papi_hwd[cidx]->ntv_name_to_code( in, ( unsigned * ) out );
02439             if (retval==PAPI_OK) {
02440                 *out = _papi_hwi_native_to_eventcode(cidx, *out, -1, in);
02441                 free (full_event_name);
02442                 INTDBG("EXIT: PAPI_OK  event: %s code: %#x\n", in, *out);
02443                 return PAPI_OK;
02444             }
02445         } else {
02446             // force the code through the work around
02447             retval = PAPI_ECMP;
02448         }
02449 
02450         /* If not implemented, work around */
02451         if ( retval==PAPI_ECMP) {
02452             i = 0;
02453             retval = _papi_hwd[cidx]->ntv_enum_events( &i, PAPI_ENUM_FIRST );
02454             if (retval != PAPI_OK) {
02455                 free (full_event_name);
02456                 INTDBG("EXIT: retval: %d\n", retval);
02457                 return retval;
02458             }
02459 
02460 //          _papi_hwi_lock( INTERNAL_LOCK );
02461 
02462             do {
02463                 // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
02464                 _papi_hwi_set_papi_event_code(i, 0);
02465                 retval = _papi_hwd[cidx]->ntv_code_to_name(i, name, sizeof(name));
02466                 /* printf("%#x\nname =|%s|\ninput=|%s|\n", i, name, in); */
02467                 if ( retval == PAPI_OK && in != NULL) {
02468                     if ( strcasecmp( name, in ) == 0 ) {
02469                         *out = _papi_hwi_native_to_eventcode(cidx, i, -1, name);
02470                         free (full_event_name);
02471                         INTDBG("EXIT: PAPI_OK, event: %s, code: %#x\n", in, *out);
02472                         return PAPI_OK;
02473                     }
02474                     retval = PAPI_ENOEVNT;
02475                 } else {
02476                     *out = 0;
02477                     retval = PAPI_ENOEVNT;
02478                     break;
02479                 }
02480             } while ( ( _papi_hwd[cidx]->ntv_enum_events( &i, PAPI_ENUM_EVENTS ) == PAPI_OK ) );
02481 
02482 //          _papi_hwi_unlock( INTERNAL_LOCK );
02483         }
02484     }
02485 
02486     free (full_event_name);
02487     INTDBG("EXIT: retval: %d\n", retval);
02488     return retval;
02489 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 553 of file papi_internal.c.

00553                                                                                              {
00554   INTDBG("Entry: cidx: %d, event: %#x, ntv_idx: %d, event_name: %s\n", cidx, event_code, ntv_idx, event_name);
00555 
00556   int result;
00557 
00558   if (papi_event_code_changed > 0) {
00559       result = _papi_hwi_get_papi_event_code();
00560       INTDBG("EXIT: papi_event_code: %#x set by the component\n", result);
00561       return result;
00562   }
00563 
00564   result=_papi_hwi_find_native_event(cidx, event_code, event_name);
00565   if (result==PAPI_ENOEVNT) {
00566      // Need to create one
00567      result=_papi_hwi_add_native_event(cidx, event_code, ntv_idx, event_name);
00568   }
00569 
00570   INTDBG("EXIT: result: %#x\n", result);
00571   return result;
00572 }

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

02371 {
02372     INTDBG("ENTER: EventCode: %#x\n", EventCode);
02373    char name[PAPI_HUGE_STR_LEN];      /* probably overkill, */
02374                                       /* but should always be big enough */
02375    int cidx;
02376    int nevt_code;
02377 
02378    cidx = _papi_hwi_component_index( EventCode );
02379    if (cidx<0) {
02380        INTDBG("EXIT: PAPI_ENOCMP\n");
02381        return PAPI_ENOCMP;
02382    }
02383 
02384    // save event code so components can get it with call to: _papi_hwi_get_papi_event_code()
02385    _papi_hwi_set_papi_event_code(EventCode, 0);
02386 
02387     if ((nevt_code = _papi_hwi_eventcode_to_native(EventCode)) < 0) {
02388         INTDBG("EXIT: nevt_code: %d\n", nevt_code);
02389         return nevt_code;
02390     }
02391    int ret = _papi_hwd[cidx]->ntv_code_to_name( (unsigned int)nevt_code, name, sizeof(name));
02392 
02393    INTDBG("EXIT: ret: %d\n", ret);
02394    return (ret);
02395 }

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

01679 {
01680     INTDBG("ENTER: context: %p, ESI: %p, values: %p\n", context, ESI, values);
01681     int retval;
01682     long long *dp = NULL;
01683     int i, index;
01684 
01685     retval = _papi_hwd[ESI->CmpIdx]->read( context, ESI->ctl_state, 
01686                            &dp, ESI->state );
01687     if ( retval != PAPI_OK ) {
01688         INTDBG("EXIT: retval: %d\n", retval);
01689        return retval;
01690     }
01691 
01692     /* This routine distributes hardware counters to software counters in the
01693        order that they were added. Note that the higher level
01694        EventInfoArray[i] entries may not be contiguous because the user
01695        has the right to remove an event.
01696        But if we do compaction after remove event, this function can be 
01697        changed.  
01698      */
01699 
01700     for ( i = 0; i != ESI->NumberOfEvents; i++ ) {
01701 
01702         index = ESI->EventInfoArray[i].pos[0];
01703 
01704         if ( index == -1 )
01705             continue;
01706 
01707         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 );
01708 
01709         /* If this is not a derived event */
01710 
01711         if ( ESI->EventInfoArray[i].derived == NOT_DERIVED ) {
01712             values[i] = dp[index];
01713             INTDBG( "value: %#llx\n", values[i] );
01714         } else {             /* If this is a derived event */
01715             values[i] = handle_derived( &ESI->EventInfoArray[i], dp );
01716 #ifdef DEBUG
01717             if ( values[i] < ( long long ) 0 ) {
01718                 INTDBG( "Derived Event is negative!!: %lld\n", values[i] );
01719             }
01720             INTDBG( "derived value: %#llx \n", values[i] );
01721 #endif
01722         }
01723     }
01724 
01725     INTDBG("EXIT: PAPI_OK\n");
01726     return PAPI_OK;
01727 }

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

01595 {
01596     int j = 0, retval, thisindex;
01597     EventInfo_t *array;
01598 
01599     thisindex =
01600         _papi_hwi_lookup_EventCodeIndex( ESI, ( unsigned int ) EventCode );
01601     if ( thisindex < PAPI_OK )
01602         return ( thisindex );
01603 
01604     /* If it is a MPX EventSet, remove it from the multiplex data structure and
01605        this threads multiplex list */
01606 
01607     if ( _papi_hwi_is_sw_multiplex( ESI ) ) {
01608         retval = mpx_remove_event( &ESI->multiplex.mpx_evset, EventCode );
01609         if ( retval < PAPI_OK )
01610             return ( retval );
01611     } else
01612         /* Remove the events hardware dependent stuff from the EventSet */
01613     {
01614         if ( IS_PRESET(EventCode) ) {
01615             int preset_index = EventCode & PAPI_PRESET_AND_MASK;
01616 
01617             /* Check if it's within the valid range */
01618             if ( ( preset_index < 0 ) ||
01619                  ( preset_index >= PAPI_MAX_PRESET_EVENTS ) )
01620                 return PAPI_EINVAL;
01621 
01622             /* Check if event exists */
01623             if ( !_papi_hwi_presets[preset_index].count )
01624                 return PAPI_ENOEVNT;
01625 
01626             /* Remove the preset event. */
01627             for ( j = 0; _papi_hwi_presets[preset_index].code[j] != (unsigned int)PAPI_NULL;
01628                   j++ );
01629             retval = remove_native_events( ESI, ( int * )_papi_hwi_presets[preset_index].code, j );
01630             if ( retval != PAPI_OK )
01631                 return ( retval );
01632         } else if ( IS_NATIVE(EventCode) ) {
01633             /* Check if native event exists */
01634             if ( _papi_hwi_query_native_event( ( unsigned int ) EventCode ) !=
01635                  PAPI_OK )
01636                 return PAPI_ENOEVNT;
01637 
01638             /* Remove the native event. */
01639             retval = remove_native_events( ESI, &EventCode, 1 );
01640             if ( retval != PAPI_OK )
01641                 return ( retval );
01642         } else if ( IS_USER_DEFINED( EventCode ) ) {
01643           int index = EventCode & PAPI_UE_AND_MASK;
01644 
01645           if ( (index < 0) || (index >= user_defined_events_count) )
01646             return ( PAPI_EINVAL );
01647 
01648           for( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT &&
01649               user_defined_events[index].code[j] != 0; j++ ) {
01650             retval = remove_native_events( ESI, ( int * )user_defined_events[index].code, j);
01651 
01652             if ( retval != PAPI_OK )
01653               return ( retval );
01654           }
01655         } else
01656             return ( PAPI_ENOEVNT );
01657     }
01658     array = ESI->EventInfoArray;
01659 
01660     /* Compact the Event Info Array list if it's not the last event */
01661     /* clear the newly empty slot in the array */
01662     for ( ; thisindex < ESI->NumberOfEvents - 1; thisindex++ )
01663         array[thisindex] = array[thisindex + 1];
01664 
01665 
01666     array[thisindex].event_code = ( unsigned int ) PAPI_NULL;
01667     for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ )
01668         array[thisindex].pos[j] = PAPI_NULL;
01669     array[thisindex].ops = NULL;
01670     array[thisindex].derived = NOT_DERIVED;
01671     ESI->NumberOfEvents--;
01672 
01673     return ( PAPI_OK );
01674 }

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

01005 {
01006     DynamicArray_t *map = &_papi_hwi_system_info.global_eventset_map;
01007     int i;
01008 
01009     i = ESI->EventSetIndex;
01010 
01011     _papi_hwi_lock( INTERNAL_LOCK );
01012 
01013     _papi_hwi_free_EventSet( ESI );
01014 
01015     /* do bookkeeping for PAPI_EVENTSET_MAP */
01016 
01017     map->dataSlotArray[i] = NULL;
01018     map->availSlots++;
01019     map->fullSlots--;
01020 
01021     _papi_hwi_unlock( INTERNAL_LOCK );
01022 
01023     return PAPI_OK;
01024 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_set_papi_event_code ( unsigned int  event_code,
int  update_flag 
)

Definition at line 119 of file papi_internal.c.

00119                                                                          {
00120     INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
00121 
00122     // if call is just to reset and start over, set both flags to show nothing saved yet
00123     if (update_flag < 0) {
00124         papi_event_code_changed = -1;
00125         papi_event_code = -1;
00126         return;
00127     }
00128 
00129     // if 0, it is being set prior to calling a component, if >0 it is being changed by the component
00130     papi_event_code_changed = update_flag;
00131     // save the event code passed in
00132     papi_event_code = event_code;
00133     return;
00134 }

Here is the caller graph for this function:

void _papi_hwi_set_papi_event_string ( const char *  event_string  ) 

Definition at line 90 of file papi_internal.c.

00090                                                            {
00091     INTDBG("event_string: %s\n", event_string);
00092     if (papi_event_string != NULL) {
00093         free (papi_event_string);
00094         papi_event_string = NULL;
00095     }
00096     if (event_string != NULL) {
00097         papi_event_string = strdup(event_string);
00098     }
00099     return;
00100 }

Here is the caller graph for this function:

void _papi_hwi_shutdown_global_internal ( void   ) 

Definition at line 1975 of file papi_internal.c.

01976 {
01977     _papi_hwi_cleanup_all_presets(  );
01978 
01979     _papi_hwi_cleanup_errors( );
01980 
01981     _papi_hwi_lock( INTERNAL_LOCK );
01982 
01983     papi_free(  _papi_hwi_system_info.global_eventset_map.dataSlotArray );
01984     memset(  &_papi_hwi_system_info.global_eventset_map, 
01985          0x00, sizeof ( DynamicArray_t ) );
01986 
01987     _papi_hwi_unlock( INTERNAL_LOCK );
01988 
01989     if ( _papi_hwi_system_info.shlib_info.map ) {
01990         papi_free( _papi_hwi_system_info.shlib_info.map );
01991     }
01992     memset( &_papi_hwi_system_info, 0x0, sizeof ( _papi_hwi_system_info ) );
01993 
01994 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PAPIERROR ( char *  format,
  ... 
)

Definition at line 601 of file papi_internal.c.

00602 {
00603     va_list args;
00604     if ( ( _papi_hwi_error_level != PAPI_QUIET ) ||
00605          ( getenv( "PAPI_VERBOSE" ) ) ) {
00606         va_start( args, format );
00607         fprintf( stderr, "\nPAPI Error: " );
00608         vfprintf( stderr, format, args );
00609         fprintf( stderr, ".\n" );
00610         va_end( args );
00611     }
00612 }

Here is the call graph for this function:


Variable Documentation

char** _papi_errlist

Definition at line 81 of file papi_internal.c.

Definition at line 55 of file papi_internal.c.

Definition at line 57 of file papi_internal.c.

Definition at line 451 of file papi_internal.h.

Definition at line 58 of file papi_internal.c.

Definition at line 56 of file papi_internal.c.

int _papi_hwi_using_signal[PAPI_NSIG]

Definition at line 368 of file extras.c.

Definition at line 1210 of file aix.c.

Definition at line 53 of file papi_internal.c.

Definition at line 1900 of file papi_internal.c.


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1