Go to the source code of this file.
◆ 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{
210
212 fprintf(
f,
" <eventset type=\"NATIVE\">\n" );
213 num = -1;
215
217
218 num++;
222 continue;
223 }
224
225
228
229
231
232
233 do {
237 continue;
238 }
240 }
242 fprintf(
f,
" </event>\n" );
243 } else {
244
247 fprintf(
f,
" </event>\n" );
248 }
249 }
251 }
252 fprintf(
f,
" </eventset>\n" );
253}
Enumerate PAPI preset or native events for a given component.
Get the event's name and description info.
#define PAPI_NTV_ENUM_UMASKS
static int test_event(int evt)
static void xmlize_event(FILE *f, PAPI_event_info_t *info, int num)
◆ 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{
178
180 fprintf(
f,
" <eventset type=\"PRESET\">\n" );
181 num = -1;
183
185 num++;
189 continue;
190 }
193 fprintf(
f,
" </event>\n" );
194 }
196 }
197 fprintf(
f,
" </eventset>\n" );
198}
◆ main()
| int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 346 of file papi_xml_event_info.c.
347{
350
351 int numc = 0;
352
355 fprintf(
stderr,
"Error! PAPI_library_init\n");
357 }
358
359
360
361#if 0
365 }
366#endif
367
368
370
373 fprintf(
stderr,
"Error! PAPI_create_eventset\n");
375 }
376
377
379
380
382
383
384 fprintf(
stdout,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
385 fprintf(
stdout,
"<eventinfo>\n" );
386
387
388
390
391
394
395 fprintf(
stdout,
"<component index=\"%d\" type=\"%s\" id=\"%s\">\n",
397
402
403 fprintf(
stdout,
"</component>\n" );
404 }
405 else {
406
409
410 fprintf(
stdout,
"<component index=\"%d\" type=\"%s\" id=\"%s\">\n",
412
417
418 fprintf(
stdout,
"</component>\n" );
419
420
423 fprintf(
stderr,
"Error! PAPI_cleanup_eventset\n");
425 }
428 fprintf(
stderr,
"Error! PAPI_destroy_eventset\n");
430 }
432
435 fprintf(
stderr,
"Error! PAPI_create_eventset\n");
437 }
438
439
441 }
442 }
443 fprintf(
stdout,
"</eventinfo>\n" );
444
445 return 0;
446}
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
get information about a specific software component
initialize the PAPI library.
Get the number of components available on the system.
Set the current debug level for error output from PAPI.
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
static void parse_command_line(int argc, char **argv, int numc)
static int papi_xml_hwinfo(FILE *f)
static void enum_preset_events(FILE *f, int cidx)
static void enum_native_events(FILE *f, int cidx)
char name[PAPI_MAX_STR_LEN]
◆ papi_xml_hwinfo()
| static int papi_xml_hwinfo |
( |
FILE * |
f | ) |
|
|
static |
Definition at line 82 of file papi_xml_event_info.c.
83{
85
88
89 fprintf(
f,
"<hardware>\n" );
90
91 fprintf(
f,
" <vendor string=\"");
94 fprintf(
f,
" <vendorCode value=\"%d\"/>\n", hwinfo->
vendor );
95 fprintf(
f,
" <model string=\"");
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 );
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
116}
get information about the system hardware
static int xmlize(const char *msg, FILE *f)
char vendor_string[PAPI_MAX_STR_LEN]
char model_string[PAPI_MAX_STR_LEN]
◆ parse_command_line()
| static void parse_command_line |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
int |
numc |
|
) |
| |
|
static |
Definition at line 272 of file papi_xml_event_info.c.
272 {
273
275
276 for(
i = 1;
i < argc;
i++ ) {
277 if ( argv[
i][0] ==
'-' ) {
278 switch ( argv[
i][1] ) {
279 case 'c':
280
281
282
283 cidx = (
i+1) < argc ? atoi( argv[(
i++)+1] ) : -1;
284 if ( cidx < 0 || cidx >= numc ) {
285 fprintf(
stderr,
"Error: component index %d out of bounds (0..%d)\n",
288 exit(1);
289 }
290 break;
291
292 case 'p':
293
296 break;
297
298 case 'n':
299
302 break;
303
304 case 'h':
305
307 exit(0);
308 break;
309
310 default:
312 "Error: unknown option: %s\n", argv[
i] );
314 exit(1);
315 }
316 } else {
317
318
319
320
321 int code = -1;
322
326 fprintf(
stderr,
"Error: unknown event: %s\n", argv[
i] );
328 exit(1);
329 }
330
334 "Error: event %s cannot be counted with others\n",
337 exit(1);
338 }
339 }
340 }
341
342}
add PAPI preset or native hardware event to an event set
Convert a name to a numeric hardware event code.
Query if PAPI event exists.
◆ test_event()
| static int test_event |
( |
int |
evt | ) |
|
|
static |
Definition at line 126 of file papi_xml_event_info.c.
127{
129
133 }
134
136 fprintf(
stderr,
"Error removing event from eventset\n" );
137 exit( 1 );
138 }
140}
removes a hardware event from a PAPI event set.
◆ usage()
| static void usage |
( |
char * |
argv[] | ) |
|
|
static |
Definition at line 260 of file papi_xml_event_info.c.
261{
262 fprintf(
stderr,
"Usage: %s [options] [[event1] event2 ...]\n", argv[0] );
263 fprintf(
stderr,
" options: -h print help message\n" );
264 fprintf(
stderr,
" -p print only preset events\n" );
265 fprintf(
stderr,
" -n print only native events\n" );
266 fprintf(
stderr,
" -c n print only events for component index n\n" );
267 fprintf(
stderr,
"If event1, event2, etc., are specified, then only events\n");
268 fprintf(
stderr,
"that can be run in addition to these events will be printed\n\n");
269}
◆ 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 )
52
53 for ( op = msg; *op != '\0'; op++ ) {
54 switch ( *op ) {
55 case '"':
56 fprintf(
f,
""" );
57 break;
58 case '&':
59 fprintf(
f,
"&" );
60 break;
61 case '\'':
62 fprintf(
f,
"'" );
63 break;
64 case '<':
66 break;
67 case '>':
69 break;
70 default:
71 fprintf(
f,
"%c", *op);
72 }
73 }
74
76}
◆ xmlize_event()
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);
153 fprintf(
f,
"\" desc=\"");
155 fprintf(
f,
"\">\n");
156 }
157 else {
158 fprintf(
f,
" <modifier name=\"");
160 fprintf(
f,
"\" desc=\"");
162 fprintf(
f,
"\"> </modifier>\n");
163 }
164
165}
char symbol[PAPI_HUGE_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]
◆ cidx
◆ EventSet
◆ native
◆ preset