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

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_assign_eventset ( EventSetInfo_t ESI,
int  cidx 
)

Definition at line 740 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_cleanup_eventset ( EventSetInfo_t ESI  ) 

Definition at line 1729 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_component_index ( int  event_code  ) 

Definition at line 514 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_convert_eventset_to_multiplex ( _papi_int_multiplex_t mpx  ) 

Definition at line 1841 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_create_eventset ( int *  EventSet,
ThreadInfo_t handle 
)

Definition at line 917 of file papi_internal.c.

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

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

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

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

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

Here is the caller graph for this function:

int _papi_hwi_eventcode_to_native ( int  event_code  ) 

Definition at line 575 of file papi_internal.c.

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

Here is the caller graph for this function:

void _papi_hwi_free_EventSet ( EventSetInfo_t ESI  ) 

Definition at line 872 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_free_papi_event_string (  ) 

Definition at line 106 of file papi_internal.c.

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

Here is the caller graph for this function:

hwd_context_t* _papi_hwi_get_context ( EventSetInfo_t ESI,
int *  is_dirty 
)

Definition at line 2651 of file papi_internal.c.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_get_ntv_idx ( unsigned int  papi_evt_code  ) 

Definition at line 141 of file papi_internal.c.

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

Here is the caller graph for this function:

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

Definition at line 135 of file papi_internal.c.

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

Here is the caller graph for this function:

char* _papi_hwi_get_papi_event_string ( void   ) 

Definition at line 101 of file papi_internal.c.

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

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_init_errors ( void   ) 

Definition at line 477 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_init_global ( void   ) 

Definition at line 1907 of file papi_internal.c.

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

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

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

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

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

Here is the caller graph for this function:

int _papi_hwi_is_sw_multiplex ( EventSetInfo_t ESI  ) 

Definition at line 2627 of file papi_internal.c.

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

Here is the caller graph for this function:

int _papi_hwi_lookup_EventCodeIndex ( const EventSetInfo_t ESI,
unsigned int  EventCode 
)

Definition at line 985 of file papi_internal.c.

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

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

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

Here is the caller graph for this function:

void _papi_hwi_map_events_to_native ( EventSetInfo_t ESI  ) 

Definition at line 1065 of file papi_internal.c.

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

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 552 of file papi_internal.c.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1676 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_event ( EventSetInfo_t ESI,
int  EventCode 
)

Definition at line 1593 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_remove_EventSet ( EventSetInfo_t ESI  ) 

Definition at line 1003 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void _papi_hwi_set_papi_event_code ( unsigned int  event_code,
int  update_flag 
)

Definition at line 118 of file papi_internal.c.

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

Here is the caller graph for this function:

void _papi_hwi_set_papi_event_string ( const char *  event_string  ) 

Definition at line 89 of file papi_internal.c.

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

Here is the caller graph for this function:

void _papi_hwi_shutdown_global_internal ( void   ) 

Definition at line 1974 of file papi_internal.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void PAPIERROR ( char *  format,
  ... 
)

Definition at line 600 of file papi_internal.c.

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

Here is the call graph for this function:


Variable Documentation

char** _papi_errlist

Definition at line 80 of file papi_internal.c.

Definition at line 54 of file papi_internal.c.

Definition at line 56 of file papi_internal.c.

Definition at line 451 of file papi_internal.h.

Definition at line 57 of file papi_internal.c.

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

Definition at line 1899 of file papi_internal.c.


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1