31{
32
37 int numcmp,cid,example_cid=-1;
38 int code,maximum_code=0;
42
43
45
46
50 }
51
53 printf( "Testing I/O component with PAPI %d.%d.%d\n",
57 }
58
59
60
62 for( cid=0; cid<numcmp; cid++) {
65 "PAPI_get_component_info failed\n", 0);
66 }
68 printf("\tComponent %d - %d events - %s\n", cid,
71 }
72 if (strstr(cmpinfo->
name,
"io")) {
73
74 example_cid=cid;
75 }
76 }
77
78
79 if (example_cid<0) {
81 "Example component not found\n", 0);
82 }
83
85 printf("\nFound io Component at id %d\n",example_cid);
86 printf("\nListing all events in this component:\n");
87 }
88
89
90
91
92
94
96
99 printf("Error translating %#x\n",code);
101 "PAPI_event_code_to_name",
retval );
102 }
103
105 printf("Error getting info for event %#x\n",code);
107 "PAPI_get_event_info()",
retval );
108 }
109
111 printf("\tEvent %#x: %s -- %s\n",
113 }
114
115 maximum_code=code;
116
118
119 }
120 if (!
quiet) printf(
"\n");
121
122
123
124
125
129 "Failed to return PAPI_ENOEVNT on invalid event",
retval );
130 }
131
132
133
134
135
139 "PAPI_create_eventset() failed\n",
retval );
140 }
141
145 "io:::rchar not found\n",
retval );
146 }
147
151 "PAPI_add_events failed\n",
retval );
152 }
153
157 "PAPI_start failed\n",
retval );
158 }
159
163 }
164
165 if (!
quiet) printf(
"Testing io:::rchar: %lld\n",
values[0]);
166
168 test_fail( __FILE__, __LINE__,
"Result should be != 0!\n", 0);
169 }
170
174 }
175
179 }
180
182
183
184
185
186
187
191 "PAPI_create_eventset() failed\n",
retval );
192 }
193
197 "io:::wchar not found\n",
retval );
198 }
199
203 "PAPI_add_events failed\n",
retval );
204 }
205
209 "PAPI_start failed\n",
retval );
210 }
211
215 }
216
217 if (!
quiet) printf(
"Testing io:::wchar: %lld\n",
values[0]);
218
220 test_fail( __FILE__, __LINE__,
"Result should be != 0!\n", 0);
221 }
222
223
224
225
226
227
231 "PAPI_start failed\n",
retval );
232 }
233
235
239 }
241 }
242
246 }
248
249
250
251
252
253
254
255
256
260 "PAPI_reset() failed\n",
retval );
261 }
262
266 "PAPI_start failed\n",
retval );
267 }
268
272 "PAPI_reset() failed\n",
retval );
273 }
274
278 }
279
280
281 if (!
quiet) printf(
"Testing after PAPI_reset(): %lld\n",
283
285 test_fail( __FILE__, __LINE__,
"Result zero!\n", 0);
286 }
287
291 }
292
296 }
297
299
300
301
302
303
304
305 if (!
quiet) printf(
"Testing Multiple Events: ");
306
310 "PAPI_create_eventset() failed\n",
retval );
311 }
312
316 "io:::rchar not found\n",
retval );
317 }
318
322 "PAPI_add_events failed\n",
retval );
323 }
324
328 "io:::wchar not found\n",
retval );
329 }
330
334 "PAPI_add_events failed\n",
retval );
335 }
336
340 "io:::read_bytes not found\n",
retval );
341 }
342
346 "PAPI_add_events failed\n",
retval );
347 }
348
349
353 "PAPI_start failed\n",
retval );
354 }
355
359 }
360
364 }
365 printf("\n");
366 }
367
369 test_fail( __FILE__, __LINE__,
"Result should be != 0!\n", 0);
370 }
371
375 }
376
380 }
381
383
384
385
386
387
388 if (!
quiet) printf(
"Testing Write\n");
389
393 "PAPI_create_eventset() failed\n",
retval );
394 }
395
399 "io:::rchar not found\n",
retval );
400 }
401
405 "PAPI_add_events failed\n",
retval );
406 }
407
411 "io:::read_bytes not found\n",
retval );
412 }
413
417 "PAPI_add_events failed\n",
retval );
418 }
419
423 "io:::wchar not found\n",
retval );
424 }
425
429 "PAPI_add_events failed\n",
retval );
430 }
431
432
436 "PAPI_start failed\n",
retval );
437 }
438
442 "PAPI_read failed\n",
retval );
443 }
444
446 printf("Before values: ");
449 }
450 printf("\n");
451 }
452
456
460 "PAPI_write failed\n",
retval );
461 }
462
466 }
467
469 printf("After values: ");
472 }
473 printf("\n");
474 }
475
476
478 test_fail( __FILE__, __LINE__,
"Result should be != 0!\n", 0);
479 }
480
484 }
485
489 }
490
492
493
494
495
496
497
498 if (!
quiet) printf(
"\n");
499
501
502 return 0;
503}
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Enumerate PAPI preset or native events for a given component.
Convert a numeric hardware event code to a name.
Convert a name to a numeric hardware event code.
get information about a specific software component
Get the event's name and description info.
initialize the PAPI library.
Get the number of components available on the system.
Read hardware counters from an event set.
Reset the hardware event counts in an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Write counter values into counters.
char event_name[2][PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
static struct counter_info * event_info
#define PAPI_VERSION_REVISION(x)
#define PAPI_VERSION_MAJOR(x)
#define PAPI_VERSION_MINOR(x)
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char name[PAPI_MAX_STR_LEN]