PAPI  5.7.0.0
papi_xml_event_info.c File Reference
Include dependency graph for papi_xml_event_info.c:

Go to the source code of this file.

Functions

static int xmlize (const char *msg, FILE *f)
 
static int papi_xml_hwinfo (FILE *f)
 
static int test_event (int evt)
 
static void xmlize_event (FILE *f, PAPI_event_info_t *info, int num)
 
static void enum_preset_events (FILE *f, int cidx)
 
static void enum_native_events (FILE *f, int cidx)
 
static void usage (char *argv[])
 

Variables

static int EventSet
 
static int preset = 1
 
static int native = 1
 
static int cidx = -1
 

Function Documentation

◆ enum_native_events()

static void enum_native_events ( FILE *  f,
int  cidx 
)
static

Definition at line 205 of file papi_xml_event_info.c.

206 {
207  int i, k, num;
208  int retval;
209  PAPI_event_info_t info;
210 
212  fprintf( f, " <eventset type=\"NATIVE\">\n" );
213  num = -1;
215 
216  while ( retval == PAPI_OK ) {
217 
218  num++;
219  retval = PAPI_get_event_info( i, &info );
220  if ( retval != PAPI_OK ) {
222  continue;
223  }
224 
225  /* enumerate any umasks */
226  k = i;
228 
229  /* Test if event can be added */
230  if ( test_event( k ) == PAPI_OK ) {
231 
232  /* add the event */
233  xmlize_event( f, &info, num );
234 
235  /* add the event's unit masks */
236  do {
237  retval = PAPI_get_event_info( k, &info );
238  if ( retval == PAPI_OK ) {
239  if ( test_event( k )!=PAPI_OK ) {
240  break;
241  }
242  xmlize_event( f, &info, -1 );
243  }
245  fprintf( f, " </event>\n" );
246  }
247  } else {
248  /* this event has no unit masks; test & write the event */
249  if ( test_event( i ) == PAPI_OK ) {
250  xmlize_event( f, &info, num );
251  fprintf( f, " </event>\n" );
252  }
253  }
255  }
256  fprintf( f, " </eventset>\n" );
257 }
#define PAPI_OK
Definition: fpapi.h:105
#define PAPI_NATIVE_MASK
double f(double a)
Definition: cpi.c:23
int retval
Definition: zero_fork.c:53
int PAPI_get_event_info(int EventCode, PAPI_event_info_t *info)
Definition: papi.c:835
static int test_event(int evt)
static int cidx
int PAPI_enum_cmp_event(int *EventCode, int modifier, int cidx)
Definition: papi.c:1357
static void xmlize_event(FILE *f, PAPI_event_info_t *info, int num)
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ enum_preset_events()

static void enum_preset_events ( FILE *  f,
int  cidx 
)
static

Definition at line 173 of file papi_xml_event_info.c.

174 {
175  int i, num;
176  int retval;
177  PAPI_event_info_t info;
178 
180  fprintf( f, " <eventset type=\"PRESET\">\n" );
181  num = -1;
183 
184  while ( retval == PAPI_OK ) {
185  num++;
186  retval = PAPI_get_event_info( i, &info );
187  if ( retval != PAPI_OK ) {
189  continue;
190  }
191  if ( test_event( i ) == PAPI_OK ) {
192  xmlize_event( f, &info, num );
193  fprintf( f, " </event>\n" );
194  }
196  }
197  fprintf( f, " </eventset>\n" );
198 }
#define PAPI_OK
Definition: fpapi.h:105
double f(double a)
Definition: cpi.c:23
#define PAPI_PRESET_MASK
int retval
Definition: zero_fork.c:53
int PAPI_get_event_info(int EventCode, PAPI_event_info_t *info)
Definition: papi.c:835
static int test_event(int evt)
static int cidx
int PAPI_enum_cmp_event(int *EventCode, int modifier, int cidx)
Definition: papi.c:1357
static void xmlize_event(FILE *f, PAPI_event_info_t *info, int num)
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ papi_xml_hwinfo()

static int papi_xml_hwinfo ( FILE *  f)
static

Definition at line 82 of file papi_xml_event_info.c.

83 {
84  const PAPI_hw_info_t *hwinfo;
85 
86  if ( ( hwinfo = PAPI_get_hardware_info( ) ) == NULL )
87  return PAPI_ESYS;
88 
89  fprintf( f, "<hardware>\n" );
90 
91  fprintf( f, " <vendor string=\"");
92  xmlize( hwinfo->vendor_string, f );
93  fprintf( f,"\"/>\n");
94  fprintf( f, " <vendorCode value=\"%d\"/>\n", hwinfo->vendor );
95  fprintf( f, " <model string=\"");
96  xmlize( hwinfo->model_string, f );
97  fprintf( f, "\"/>\n");
98  fprintf( f, " <modelCode value=\"%d\"/>\n", hwinfo->model );
99  fprintf( f, " <cpuRevision value=\"%f\"/>\n", hwinfo->revision );
100  fprintf( f, " <cpuID>\n" );
101  fprintf( f, " <family value=\"%d\"/>\n", hwinfo->cpuid_family );
102  fprintf( f, " <model value=\"%d\"/>\n", hwinfo->cpuid_model );
103  fprintf( f, " <stepping value=\"%d\"/>\n", hwinfo->cpuid_stepping );
104  fprintf( f, " </cpuID>\n" );
105  fprintf( f, " <cpuMaxMegahertz value=\"%d\"/>\n", hwinfo->cpu_max_mhz );
106  fprintf( f, " <cpuMinMegahertz value=\"%d\"/>\n", hwinfo->cpu_min_mhz );
107  fprintf( f, " <threads value=\"%d\"/>\n", hwinfo->threads );
108  fprintf( f, " <cores value=\"%d\"/>\n", hwinfo->cores );
109  fprintf( f, " <sockets value=\"%d\"/>\n", hwinfo->sockets );
110  fprintf( f, " <nodes value=\"%d\"/>\n", hwinfo->nnodes );
111  fprintf( f, " <cpuPerNode value=\"%d\"/>\n", hwinfo->ncpu );
112  fprintf( f, " <totalCPUs value=\"%d\"/>\n", hwinfo->totalcpus );
113  fprintf( f, "</hardware>\n" );
114 
115  return PAPI_OK;
116 }
#define PAPI_OK
Definition: fpapi.h:105
int cores
Definition: papi.h:784
double f(double a)
Definition: cpi.c:23
Hardware info structure.
Definition: papi.h:781
int cpu_min_mhz
Definition: papi.h:798
int cpuid_stepping
Definition: papi.h:795
#define PAPI_ESYS
Definition: fpapi.h:108
int threads
Definition: papi.h:783
float revision
Definition: papi.h:792
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:791
int cpuid_model
Definition: papi.h:794
int nnodes
Definition: papi.h:786
int cpuid_family
Definition: papi.h:793
char vendor_string[PAPI_MAX_STR_LEN]
Definition: papi.h:789
int vendor
Definition: papi.h:788
int model
Definition: papi.h:790
static int xmlize(const char *msg, FILE *f)
int cpu_max_mhz
Definition: papi.h:797
int totalcpus
Definition: papi.h:787
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
Definition: papi.c:6185
int sockets
Definition: papi.h:785
int ncpu
Definition: papi.h:782
Here is the call graph for this function:

◆ test_event()

static int test_event ( int  evt)
static

Definition at line 126 of file papi_xml_event_info.c.

127 {
128  int retval;
129 
130  retval = PAPI_add_event( EventSet, evt );
131  if ( retval != PAPI_OK ) {
132  return retval;
133  }
134 
135  if ( ( retval = PAPI_remove_event( EventSet, evt ) ) != PAPI_OK ) {
136  fprintf( stderr, "Error removing event from eventset\n" );
137  exit( 1 );
138  }
139  return PAPI_OK;
140 }
#define PAPI_OK
Definition: fpapi.h:105
static int EventSet
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1663
int PAPI_remove_event(int EventSet, int EventCode)
Definition: papi.c:1758
int retval
Definition: zero_fork.c:53
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ usage()

static void usage ( char *  argv[])
static

Definition at line 264 of file papi_xml_event_info.c.

◆ xmlize()

static int xmlize ( const char *  msg,
FILE *  f 
)
static

Definition at line 46 of file papi_xml_event_info.c.

47 {
48  const char *op;
49 
50  if ( !msg )
51  return PAPI_OK;
52 
53  for ( op = msg; *op != '\0'; op++ ) {
54  switch ( *op ) {
55  case '"':
56  fprintf( f, "&quot;" );
57  break;
58  case '&':
59  fprintf( f, "&amp;" );
60  break;
61  case '\'':
62  fprintf( f, "&apos;" );
63  break;
64  case '<':
65  fprintf( f, "&lt;" );
66  break;
67  case '>':
68  fprintf( f, "&gt;" );
69  break;
70  default:
71  fprintf( f, "%c", *op);
72  }
73  }
74 
75  return PAPI_OK;
76 }
#define PAPI_OK
Definition: fpapi.h:105
double f(double a)
Definition: cpi.c:23
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmlize_event()

static void xmlize_event ( FILE *  f,
PAPI_event_info_t info,
int  num 
)
static

Definition at line 147 of file papi_xml_event_info.c.

148 {
149 
150  if ( num >= 0 ) {
151  fprintf( f, " <event index=\"%d\" name=\"",num);
152  xmlize( info->symbol, f );
153  fprintf( f, "\" desc=\"");
154  xmlize( info->long_descr, f );
155  fprintf( f, "\">\n");
156  }
157  else {
158  fprintf( f," <modifier name=\"");
159  xmlize( info->symbol, f );
160  fprintf( f,"\" desc=\"");
161  xmlize( info->long_descr, f );
162  fprintf( f,"\"> </modifier>\n");
163  }
164 
165 }
double f(double a)
Definition: cpi.c:23
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:970
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:967
static int xmlize(const char *msg, FILE *f)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cidx

int cidx = -1
static

Definition at line 40 of file papi_xml_event_info.c.

◆ EventSet

int EventSet
static

Definition at line 37 of file papi_xml_event_info.c.

◆ native

int native = 1
static

Definition at line 39 of file papi_xml_event_info.c.

◆ preset

int preset = 1
static

Definition at line 38 of file papi_xml_event_info.c.