papi_preset.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hwi_search_t
struct  hwi_presets_t
struct  hwi_describe_t

Functions

int _papi_hwi_setup_all_presets (hwi_search_t *findem, int cidx)
int _papi_hwi_cleanup_all_presets (void)
int _xml_papi_hwi_setup_all_presets (char *arch)
int _papi_load_preset_table (char *name, int type, int cidx)

Variables

hwi_search_tpreset_search_map
hwi_presets_t _papi_hwi_presets [PAPI_MAX_PRESET_EVENTS]

Detailed Description

Author:
Haihang You you@cs.utk.edu

Definition in file papi_preset.h.


Function Documentation

int _papi_hwi_cleanup_all_presets ( void   ) 

Definition at line 114 of file papi_preset.c.

00115 {
00116         int preset_index,cidx;
00117     unsigned int j;
00118 
00119     for ( preset_index = 0; preset_index < PAPI_MAX_PRESET_EVENTS;
00120           preset_index++ ) {
00121         if ( _papi_hwi_presets[preset_index].postfix != NULL ) {
00122            papi_free( _papi_hwi_presets[preset_index].postfix );
00123            _papi_hwi_presets[preset_index].postfix = NULL;
00124         }
00125         if ( _papi_hwi_presets[preset_index].note != NULL ) {
00126            papi_free( _papi_hwi_presets[preset_index].note );
00127            _papi_hwi_presets[preset_index].note = NULL;
00128         }
00129         for(j=0; j<_papi_hwi_presets[preset_index].count;j++) {
00130            papi_free(_papi_hwi_presets[preset_index].name[j]);
00131         }
00132     }
00133 
00134     for(cidx=0;cidx<papi_num_components;cidx++) {
00135        _papi_hwd[cidx]->cmp_info.num_preset_events = 0;
00136     }
00137 
00138 #if defined(ITANIUM2) || defined(ITANIUM3)
00139     /* NOTE: This memory may need to be freed for BG/P builds as well */
00140     if ( preset_search_map != NULL ) {
00141         papi_free( preset_search_map );
00142         preset_search_map = NULL;
00143     }
00144 #endif
00145 
00146     return PAPI_OK;
00147 }

Here is the caller graph for this function:

int _papi_hwi_setup_all_presets ( hwi_search_t findem,
int  cidx 
)

Definition at line 44 of file papi_preset.c.

00045 {
00046     int i, pnum, did_something = 0;
00047     unsigned int preset_index, j, k;
00048 
00049     /* dense array of events is terminated with a 0 preset.
00050        don't do anything if NULL pointer. This allows just notes to be loaded.
00051        It's also good defensive programming.
00052      */
00053     if ( findem != NULL ) {
00054        for ( pnum = 0; ( pnum < PAPI_MAX_PRESET_EVENTS ) &&
00055               ( findem[pnum].event_code != 0 ); pnum++ ) {
00056        /* find the index for the event to be initialized */
00057        preset_index = ( findem[pnum].event_code & PAPI_PRESET_AND_MASK );
00058        /* count and set the number of native terms in this event, 
00059               these items are contiguous.
00060 
00061           PAPI_EVENTS_IN_DERIVED_EVENT is arbitrarily defined in the high 
00062               level to be a reasonable number of terms to use in a derived 
00063               event linear expression, currently 8.
00064 
00065           This wastes space for components with less than 8 counters, 
00066               but keeps the framework independent of the components.
00067 
00068           The 'native' field below is an arbitrary opaque identifier 
00069               that points to information on an actual native event. 
00070               It is not an event code itself (whatever that might mean).
00071           By definition, this value can never == PAPI_NULL.
00072           - dkt */
00073 
00074        INTDBG( "Counting number of terms for preset index %d, "
00075                    "search map index %d.\n", preset_index, pnum );
00076        i = 0;
00077        j = 0;
00078        while ( i < PAPI_EVENTS_IN_DERIVED_EVENT ) {
00079           if ( findem[pnum].native[i] != PAPI_NULL ) {
00080          j++;
00081           }
00082           else if ( j ) {
00083          break;
00084           }
00085           i++;
00086        }
00087 
00088        INTDBG( "This preset has %d terms.\n", j );
00089        _papi_hwi_presets[preset_index].count = j;
00090  
00091            _papi_hwi_presets[preset_index].derived_int = findem[pnum].derived;
00092        for(k=0;k<j;k++) {
00093               _papi_hwi_presets[preset_index].code[k] =
00094                      findem[pnum].native[k];
00095        }
00096        /* preset code list must be PAPI_NULL terminated */
00097        if (k<PAPI_EVENTS_IN_DERIVED_EVENT) {
00098               _papi_hwi_presets[preset_index].code[k] = PAPI_NULL;
00099        }
00100 
00101        _papi_hwi_presets[preset_index].postfix=
00102                                        papi_strdup(findem[pnum].operation);
00103 
00104        did_something++;
00105        }
00106     }
00107 
00108     _papi_hwd[cidx]->cmp_info.num_preset_events += did_something;
00109 
00110     return ( did_something ? PAPI_OK : PAPI_ENOEVNT );
00111 }

Here is the caller graph for this function:

int _papi_load_preset_table ( char *  name,
int  type,
int  cidx 
)

Definition at line 771 of file papi_preset.c.

00771                                                                    {
00772     SUBDBG("ENTER: pmu_str: %s, pmu_type: %d, cidx: %d\n", pmu_str, pmu_type, cidx);
00773 
00774     int retval;
00775 
00776     // go load papi preset events (last argument tells function if we are loading presets or user events)
00777     retval = papi_load_derived_events(pmu_str, pmu_type, cidx, 1);
00778     if (retval != PAPI_OK) {
00779         SUBDBG("EXIT: retval: %d\n", retval);
00780         return retval;
00781     }
00782 
00783     // go load the user defined event definitions if any are defined
00784     retval = papi_load_derived_events(pmu_str, pmu_type, cidx, 0);
00785 
00786     SUBDBG("EXIT: retval: %d\n", retval);
00787     return retval;
00788 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _xml_papi_hwi_setup_all_presets ( char *  arch  ) 

Variable Documentation

hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]

Definition at line 6 of file papi_common_strings.h.

Definition at line 123 of file perfctr-ppc64.c.


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1