PAPI  5.4.1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

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 
134  for(cidx=0;cidx<papi_num_components;cidx++) {
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 }
#define papi_free(a)
Definition: papi_memory.h:35
#define PAPI_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
static int cidx
Definition: event_info.c:40
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
hwi_search_t * preset_search_map
int papi_num_components
char * name
Definition: iozone.c:23648
long j
Definition: iozone.c:19135
unsigned int count
Definition: papi_preset.h:29
char * postfix
Definition: papi_preset.h:31

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.

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;
78  while ( i < PAPI_EVENTS_IN_DERIVED_EVENT ) {
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 }
#define PAPI_ENOEVNT
Definition: papi.h:258
#define PAPI_EVENTS_IN_DERIVED_EVENT
Definition: genpapifdef.c:39
unsigned int event_code
Definition: papi_preset.h:14
#define PAPI_NULL
Definition: papi.h:290
#define PAPI_MAX_PRESET_EVENTS
return PAPI_OK
Definition: linux-nvml.c:458
#define papi_strdup(a)
Definition: papi_memory.h:39
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
papi_vector_t * _papi_hwd[]
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int i
Definition: fileop.c:140
static int cidx
Definition: event_info.c:40
int k
Definition: iozone.c:19136
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
static int native
Definition: event_info.c:39
int native[PAPI_EVENTS_IN_DERIVED_EVENT]
Definition: papi_preset.h:16
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
#define PAPI_PRESET_AND_MASK
long j
Definition: iozone.c:19135
unsigned int count
Definition: papi_preset.h:29
char * postfix
Definition: papi_preset.h:31

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.

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 }
return PAPI_OK
Definition: linux-nvml.c:458
static int papi_load_derived_events(char *pmu_str, int pmu_type, int cidx, int preset_flag)
Definition: papi_preset.c:1039
static int cidx
Definition: event_info.c:40
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
ssize_t retval
Definition: libasync.c:338

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

Definition at line 6 of file papi_common_strings.h.

hwi_search_t* preset_search_map

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