409{
412 int num_cmp_events = 0;
417 int enum_modifier;
418 int numcmp, cid;
419
420
423 fprintf(
stderr,
"Error! PAPI_library_init\n");
425 }
426
427
429
430
433 else if ( flags.
darr )
435 else if ( flags.
iear )
437 else if ( flags.
iarr )
439 else if ( flags.
opcm )
441 else
443
446 fprintf(
stderr,
"Error! PAPI_set_debug\n");
448 }
449
452 fprintf(
stderr,
"Error! PAPI_get_hardware_info\n");
453 return 2;
454 }
455
456#if SDE
457
458
459
460
461
462
464 char *cmd;
465 FILE *pipe;
466
467 if ( access(flags.
path, R_OK) == -1 ){
468 fprintf(
stderr,
"Error! Unable to read file '%s'.\n",flags.
path);
469 goto no_sdes;
470 }
471
472 int len = 5+strlen(flags.
path);
473 cmd = (char *)calloc(len, sizeof(char));
474 if( NULL == cmd ) goto no_sdes;
475
476 int l = snprintf(cmd, len,
"ldd %s",flags.
path);
477 if(l<len-1){
478 free(cmd);
479 goto no_sdes;
480 }
481
482
483 pipe = popen(cmd, "r");
484 if( NULL != pipe ){
485 while( !feof(pipe) ){
486 char *lineptr, *lib_name, *lib_path;
487 size_t n=0;
488 lineptr = lib_name = lib_path = NULL;
489
490 if( getline(&lineptr, &n, pipe) == -1 ){
491 if(lineptr) free(lineptr);
492 break;
493 }
494
495
496 if( (NULL != strstr(lineptr,"not found")) || (NULL == strstr(lineptr," => ")) ) {
497 goto skip_lib;
498 }
499
500 int status = sscanf(lineptr, "%ms => %ms (%*x)", &lib_name, &lib_path);
501
502 if(2 != status){
503
504
505 goto skip_lib;
506 }
507
508
509 invoke_hook_fptr(lib_path);
510
511 if( lib_name ) free(lib_name);
512 if( lib_path ) free(lib_path);
513skip_lib:
514 if(lineptr) free(lineptr);
515 lineptr = NULL;
516 n=0;
517 }
518 pclose(pipe);
519 }
520
521
522 invoke_hook_fptr(flags.
path);
523
524 if( NULL != cmd ) free(cmd);
525 }
526no_sdes:
527#endif
528
529
533 printf(
"Event name: %s\n", info.
symbol);
534 printf(
"Description: %s\n", info.
long_descr );
535
536
537 char *ptr;
538 if ((ptr=strstr(flags.
name,
":::"))) {
539 ptr+=3;
540
541 }
else if ((ptr=strstr(flags.
name,
"::"))) {
542 ptr+=2;
543 }
544 else {
546 }
547
548
549 if ( !strchr( ptr, ':' ) ) {
551 printf( "\nQualifiers: Name -- Description\n" );
552 do {
557 }
558 }
560 }
561 }
562 }
563 } else {
564 printf("Sorry, an event by the name '%s' could not be found.\n",
566 printf("Is it typed correctly?\n\n");
567 exit( 1 );
568 }
569 return 0;
570 }
571
572
573
575
577
578 for ( cid = 0; cid < numcmp; cid++ ) {
581
582
584
585 printf( "===============================================================================\n" );
586 printf(
" Native Events in Component: %s\n",component->
name);
587 printf( "===============================================================================\n" );
588
589
590 num_cmp_events = 0;
591
592
593
595
597
599 do {
600 memset( &info, 0, sizeof ( info ) );
602
603
605
606
608
609
611
612
613 if (num_cmp_events) {
614 printf( "--------------------------------------------------------------------------------\n" );
615 }
616
617
619 num_cmp_events++;
620
623 }
624
626
627
628
629
630
631
632
633
637 printf( "Groups: " );
638 do {
642 printf( "\n" );
643 }
644 }
645
646
647
648
649
650
651
652
656
658
659 do {
662
663 if (strlen(first_event_mask_string) == 0) {
664 strcpy (first_event_mask_string, info.
symbol);
665 }
666
669 }
670
674 }
675 }
677
679
680
681
682 strcpy (info.
symbol, first_event_mask_string);
683 strcat (info.
symbol,
":cpu=1");
685 }
687
688
689 strcpy (info.
symbol, first_event_mask_string);
690 char *wptr = strrchr (info.
symbol,
':');
691 if (wptr != NULL) {
692 *wptr = '\0';
693 strcat (info.
symbol,
":ff=64:cpu=1");
695 }
696 }
697 }
698 }
701 }
702 }
703
704 if (num_cmp_events != 0) {
705 printf( "--------------------------------------------------------------------------------\n" );
706 }
707 printf(
"\nTotal events reported: %d\n",
num_events );
708
710 printf("\nNo events detected! Check papi_component_avail to find out why.\n");
711 printf("\n");
712 }
713
714
715 return 0;
716}
Enumerate PAPI preset or native events for a given component.
Enumerate PAPI preset or native events.
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.
Set the current debug level for error output from PAPI.
#define PAPI_NTV_GROUP_AND_MASK
#define PAPI_NTV_ENUM_IEAR
#define PAPI_NTV_ENUM_UMASKS
#define PAPI_NTV_ENUM_OPCM
#define PAPI_NTV_GROUP_SHIFT
#define PAPI_NTV_ENUM_DEAR
#define PAPI_NTV_ENUM_DARR
#define PAPI_NTV_ENUM_IARR
#define PAPI_HUGE_STR_LEN
static int format_event_output(PAPI_event_info_t *info, int offset)
static void print_event_output(int val_flag)
static int parse_event_qualifiers(PAPI_event_info_t *info)
static void check_event(PAPI_event_info_t *info)
static void parse_args(int argc, char **argv, command_flags_t *f)
char name[PAPI_MAX_STR_LEN]