PAPI 7.1.0.0
Loading...
Searching...
No Matches
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@c.nosp@m.s.ut.nosp@m.k.edu

Definition in file papi_preset.h.

Function Documentation

◆ _papi_hwi_cleanup_all_presets()

int _papi_hwi_cleanup_all_presets ( void  )

Definition at line 114 of file papi_preset.c.

115{
116 int preset_index,cidx;
117 unsigned int j;
118
119 for ( preset_index = 0; preset_index < PAPI_MAX_PRESET_EVENTS;
120 preset_index++ ) {
121 if ( _papi_hwi_presets[preset_index].postfix != NULL ) {
122 papi_free( _papi_hwi_presets[preset_index].postfix );
123 _papi_hwi_presets[preset_index].postfix = NULL;
124 }
125 if ( _papi_hwi_presets[preset_index].note != NULL ) {
126 papi_free( _papi_hwi_presets[preset_index].note );
127 _papi_hwi_presets[preset_index].note = NULL;
128 }
129 for(j=0; j<_papi_hwi_presets[preset_index].count;j++) {
130 papi_free(_papi_hwi_presets[preset_index].name[j]);
131 }
132 }
133
135 _papi_hwd[cidx]->cmp_info.num_preset_events = 0;
136 }
137
138#if defined(ITANIUM2) || defined(ITANIUM3)
139 /* NOTE: This memory may need to be freed for BG/P builds as well */
140 if ( preset_search_map != NULL ) {
142 preset_search_map = NULL;
143 }
144#endif
145
146 return PAPI_OK;
147}
struct papi_vectors * _papi_hwd[]
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_MAX_PRESET_EVENTS
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
int papi_num_components
#define papi_free(a)
Definition: papi_memory.h:35
static int cidx
hwi_search_t * preset_search_map
const char * name
Definition: rocs.c:225
unsigned int count
Definition: papi_preset.h:29
char * postfix
Definition: papi_preset.h:31
Here is the caller graph for this function:

◆ _papi_hwi_setup_all_presets()

int _papi_hwi_setup_all_presets ( hwi_search_t findem,
int  cidx 
)

Definition at line 44 of file papi_preset.c.

45{
46 int i, pnum, did_something = 0;
47 unsigned int preset_index, j, k;
48
49 /* dense array of events is terminated with a 0 preset.
50 don't do anything if NULL pointer. This allows just notes to be loaded.
51 It's also good defensive programming.
52 */
53 if ( findem != NULL ) {
54 for ( pnum = 0; ( pnum < PAPI_MAX_PRESET_EVENTS ) &&
55 ( findem[pnum].event_code != 0 ); pnum++ ) {
56 /* find the index for the event to be initialized */
57 preset_index = ( findem[pnum].event_code & PAPI_PRESET_AND_MASK );
58 /* count and set the number of native terms in this event,
59 these items are contiguous.
60
61 PAPI_EVENTS_IN_DERIVED_EVENT is arbitrarily defined in the high
62 level to be a reasonable number of terms to use in a derived
63 event linear expression, currently 8.
64
65 This wastes space for components with less than 8 counters,
66 but keeps the framework independent of the components.
67
68 The 'native' field below is an arbitrary opaque identifier
69 that points to information on an actual native event.
70 It is not an event code itself (whatever that might mean).
71 By definition, this value can never == PAPI_NULL.
72 - dkt */
73
74 INTDBG( "Counting number of terms for preset index %d, "
75 "search map index %d.\n", preset_index, pnum );
76 i = 0;
77 j = 0;
79 if ( findem[pnum].native[i] != PAPI_NULL ) {
80 j++;
81 }
82 else if ( j ) {
83 break;
84 }
85 i++;
86 }
87
88 INTDBG( "This preset has %d terms.\n", j );
89 _papi_hwi_presets[preset_index].count = j;
90
91 _papi_hwi_presets[preset_index].derived_int = findem[pnum].derived;
92 for(k=0;k<j;k++) {
93 _papi_hwi_presets[preset_index].code[k] =
94 findem[pnum].native[k];
95 }
96 /* preset code list must be PAPI_NULL terminated */
98 _papi_hwi_presets[preset_index].code[k] = PAPI_NULL;
99 }
100
101 _papi_hwi_presets[preset_index].postfix=
102 papi_strdup(findem[pnum].operation);
103
104 did_something++;
105 }
106 }
107
108 _papi_hwd[cidx]->cmp_info.num_preset_events += did_something;
109
110 return ( did_something ? PAPI_OK : PAPI_ENOEVNT );
111}
int i
#define PAPI_NULL
Definition: f90papi.h:78
#define PAPI_ENOEVNT
Definition: f90papi.h:139
#define PAPI_PRESET_AND_MASK
#define INTDBG(format, args...)
Definition: papi_debug.h:66
#define PAPI_EVENTS_IN_DERIVED_EVENT
#define papi_strdup(a)
Definition: papi_memory.h:39
static int native
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
unsigned int event_code
Definition: papi_preset.h:14
int native[PAPI_EVENTS_IN_DERIVED_EVENT]
Definition: papi_preset.h:16
Here is the caller graph for this function:

◆ _papi_load_preset_table()

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

Definition at line 771 of file papi_preset.c.

771 {
772 SUBDBG("ENTER: pmu_str: %s, pmu_type: %d, cidx: %d\n", pmu_str, pmu_type, cidx);
773
774 int retval;
775
776 // go load papi preset events (last argument tells function if we are loading presets or user events)
777 retval = papi_load_derived_events(pmu_str, pmu_type, cidx, 1);
778 if (retval != PAPI_OK) {
779 SUBDBG("EXIT: retval: %d\n", retval);
780 return retval;
781 }
782
783 // go load the user defined event definitions if any are defined
784 retval = papi_load_derived_events(pmu_str, pmu_type, cidx, 0);
785
786 SUBDBG("EXIT: retval: %d\n", retval);
787 return retval;
788}
#define SUBDBG(format, args...)
Definition: papi_debug.h:64
static int papi_load_derived_events(char *pmu_str, int pmu_type, int cidx, int preset_flag)
Definition: papi_preset.c:947
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _xml_papi_hwi_setup_all_presets()

int _xml_papi_hwi_setup_all_presets ( char *  arch)

Variable Documentation

◆ _papi_hwi_presets

hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
extern

Definition at line 6 of file papi_common_strings.h.

◆ preset_search_map

hwi_search_t* preset_search_map
extern

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