199{
201 int retval_start,retval_stop;
202 int bins = 100;
203 int show_dist = 0, show_std_dev = 0, show_percent = 0;
204 long long totcyc,
values[2];
206 int event;
209
210
211
212 while ( (
c=getopt(argc, argv,
"hb:dpst:") ) != -1) {
213
215
216 case 'h':
218 exit(1);
219 case 'b':
220 bins=atoi(optarg);
221 break;
222 case 'd':
223 show_dist=1;
224 break;
225 case 'p':
226 show_percent=1;
227 break;
228 case 's':
229 show_std_dev=1;
230 break;
231 case 't':
233 break;
234 default:
236 exit(1);
237 break;
238 }
239
240 }
241
242 printf( "Cost of execution for PAPI start/stop, read and accum.\n" );
243 printf( "This test takes a while. Please be patient...\n" );
244
247 fprintf(
stderr,
"PAPI_library_init\n");
249 }
252 fprintf(
stderr,
"PAPI_set_debug\n");
254 }
257 fprintf(
stderr,
"PAPI_query_event\n");
259 }
262 fprintf(
stderr,
"PAPI_query_event\n");
264 }
267 fprintf(
stderr,
"PAPI_create_eventset\n");
269 }
272 fprintf(
stderr,
"PAPI_add_event\n");
274 }
279 fprintf(
stderr,
"PAPI_add_event\n");
281 }
282 }
283
284
285
288 fprintf(
stderr,
"PAPI_start");
290 }
292 fprintf(
stderr,
"PAPI_stop");
294 }
295
297 if (
array == NULL ) {
298 fprintf(
stderr,
"Error allocating memory for results\n");
300 }
301
302
303
304 printf( "\nPerforming loop latency test...\n" );
305
310 }
311
312 do_output( 0,
array, bins, show_std_dev, show_dist, show_percent );
313
314
315
316 printf( "\nPerforming start/stop test...\n" );
317
324 if (retval_start || retval_stop) {
325 fprintf(
stderr,
"PAPI start/stop\n");
326 exit(retval_start );
327 }
328 }
329
330 do_output( 1,
array, bins, show_std_dev, show_dist, show_percent );
331
332
333 printf( "\nPerforming read test...\n" );
334
336 fprintf(
stderr,
"PAPI_start");
338 }
340
346 }
348 fprintf(
stderr,
"PAPI_stop");
350 }
351
352 do_output( 2,
array, bins, show_std_dev, show_dist, show_percent );
353
354
355 printf( "\nPerforming read with timestamp test...\n" );
356
358 fprintf(
stderr,
"PAPI_start");
360 }
362
365 }
367 fprintf(
stderr,
"PAPI_stop");
369 }
370
371
374 }
376
377 do_output( 3,
array, bins, show_std_dev, show_dist, show_percent );
378
379
380 printf( "\nPerforming accum test...\n" );
381
383 fprintf(
stderr,
"PAPI_start");
385 }
387
393 }
395 fprintf(
stderr,
"PAPI_stop");
397 }
398
399 do_output( 4,
array, bins, show_std_dev, show_dist, show_percent );
400
401
402 printf( "\nPerforming reset test...\n" );
403
405 fprintf(
stderr,
"PAPI_start");
407 }
408
414 }
416 fprintf(
stderr,
"PAPI_stop");
418 }
419
420 do_output( 5,
array, bins, show_std_dev, show_dist, show_percent );
421
422
424
426
429
431 printf( "\nPerforming DERIVED_POSTFIX "
432 "PAPI_read(%d counters) test (%s)...",
434
437 fprintf(
stderr,
"PAPI_add_event");
439 }
440
443 fprintf(
stderr,
"PAPI_start");
445 }
446
448
454 }
455
458 fprintf(
stderr,
"PAPI_stop");
460 }
461
462 do_output( 6,
array, bins, show_std_dev, show_dist, show_percent );
463
464 } else {
465 printf("\tI was unable to find a DERIVED_POSTFIX preset event "
466 "to test on this architecture, skipping.\n");
467 }
468
469
471
473
476
478 printf( "\nPerforming DERIVED_[ADD|SUB] "
479 "PAPI_read(%d counters) test (%s)...",
481
484 fprintf(
stderr,
"PAPI_add_event\n");
486 }
487
490 fprintf(
stderr,
"PAPI_start");
492 }
493
495
501 }
502
505 fprintf(
stderr,
"PAPI_stop");
507 }
508
509 do_output( 7,
array, bins, show_std_dev, show_dist, show_percent );
510 } else {
511 printf("\tI was unable to find a suitable DERIVED_[ADD|SUB] "
512 "event to test, skipping.\n");
513 }
514
516
517 return 0;
518}
Accumulate and reset counters in an EventSet.
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
get real time counter value in clock cycles Returns the total real time passed since some arbitrary s...
initialize the PAPI library.
Query if PAPI event exists.
Read hardware counters with a timestamp.
Read hardware counters from an event set.
Reset the hardware event counts in an event set.
Set the current debug level for error output from PAPI.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static long long values[NUM_EVENTS]
static double c[MATRIX_SIZE][MATRIX_SIZE]
static int find_derived_add(int i)
static void do_output(int test_type, long long *array, int bins, int show_std_dev, int show_dist, int show_percentile)
static int find_derived_postfix(int i)
static void print_help(void)
char symbol[PAPI_HUGE_STR_LEN]