190 if ( strlen( info->
derived ) == 0 )
192 else if ( strcmp( info->
derived,
"NOT_DERIVED" ) == 0 )
194 else if ( strcmp( info->
derived,
"DERIVED_CMPD" ) == 0 )
203 printf(
"This is the PAPI avail program.\n" );
204 printf(
"It provides availability and details about PAPI Presets and User-defined Events.\n" );
205 printf(
"PAPI Preset Event filters can be combined in a logical OR.\n" );
206 printf(
"Usage: %s [options]\n", argv[0] );
207 printf(
"Options:\n\n" );
208 printf(
"General command options:\n" );
209 printf(
"\t-h, --help Print this help message\n" );
210 printf(
"\t-a, --avail Display only available PAPI preset and user defined events\n" );
211 printf(
"\t-c, --check Display only available PAPI preset and user defined events after an availability check\n" );
212 printf(
"\t-d, --detail Display detailed information about events\n" );
213 printf(
"\t-e EVENTNAME Display detail information about specified event\n" );
214 printf(
"\nEvent filtering options:\n" );
215 printf(
"\t--br Display branch related PAPI preset events\n" );
216 printf(
"\t--cache Display cache related PAPI preset events\n" );
217 printf(
"\t--cnd Display conditional PAPI preset events\n" );
218 printf(
"\t--fp Display Floating Point related PAPI preset events\n" );
219 printf(
"\t--ins Display instruction related PAPI preset events\n" );
220 printf(
"\t--idl Display Stalled or Idle PAPI preset events\n" );
221 printf(
"\t--l1 Display level 1 cache related PAPI preset events\n" );
222 printf(
"\t--l2 Display level 2 cache related PAPI preset events\n" );
223 printf(
"\t--l3 Display level 3 cache related PAPI preset events\n" );
224 printf(
"\t--mem Display memory related PAPI preset events\n" );
225 printf(
"\t--msc Display miscellaneous PAPI preset events\n" );
226 printf(
"\t--tlb Display Translation Lookaside Buffer PAPI preset events\n" );
235 if ( ( pmask = strchr( info->
symbol,
':' ) ) == NULL ) {
238 memmove( info->
symbol, pmask, ( strlen( pmask ) + 1 ) *
sizeof (
char ) );
243 memmove( info->
long_descr, pmask + sizeof (
char ),
244 ( strlen( pmask ) + 1 ) *
sizeof (
char ) );
272 int check_counter = 1;
285 if ( (check_counter &&
checkCounter (event_code)) || !check_counter) {
303 unsigned int filter = 0;
304 int print_event_info = 0;
307 int print_tabular = 1;
313 int check_counter = 0;
320 for( args = 1; args < argc; args++ ) {
321 if ( strstr( argv[args],
"-e" ) ) {
322 print_event_info = 1;
323 if( (args+1 >= argc) || ( argv[args+1] == NULL ) || ( strlen( argv[args+1] ) == 0 ) ) {
327 name = argv[args + 1];
329 else if ( strstr( argv[args],
"-c" ) || strstr (argv[args],
"--check") )
334 else if ( strstr( argv[args],
"-a" ))
336 else if ( strstr( argv[args],
"-d" ) )
338 else if ( strstr( argv[args],
"-h" ) ) {
341 }
else if ( strstr( argv[args],
"--br" ) )
343 else if ( strstr( argv[args],
"--cache" ) )
345 else if ( strstr( argv[args],
"--cnd" ) )
347 else if ( strstr( argv[args],
"--fp" ) )
349 else if ( strstr( argv[args],
"--ins" ) )
351 else if ( strstr( argv[args],
"--idl" ) )
353 else if ( strstr( argv[args],
"--l1" ) )
355 else if ( strstr( argv[args],
"--l2" ) )
357 else if ( strstr( argv[args],
"--l3" ) )
359 else if ( strstr( argv[args],
"--mem" ) )
361 else if ( strstr( argv[args],
"--msc" ) )
363 else if ( strstr( argv[args],
"--tlb" ) )
368 filter = (
unsigned int ) ( -1 );
375 fprintf(
stderr,
"Error! PAPI library mismatch!\n");
382 fprintf(
stderr,
"Error with PAPI_set debug!\n");
389 fprintf(
stderr,
"Error with PAPI_get_hardware_info!\n");
395 if ( print_event_info ) {
401 printf(
"%-30s%s\n%-30s%#-10x\n%-30s%d\n",
402 "Event name:", info.
symbol,
"Event Code:",
405 printf(
"%-29s|%s|\n%-29s|%s|\n%-29s|%s|\n",
408 "Developer's Notes:", info.
note );
409 printf(
"%-29s|%s|\n%-29s|%s|\n",
"Derived Type:",
410 info.
derived,
"Postfix Processing String:",
413 for( j = 0; j < (
int ) info.
count; j++ ) {
414 printf(
" Native Code[%d]: %#x |%s|\n", j,
417 printf(
" Number of Register Values: %d\n", n_info.
count );
418 for( k = 0; k < (
int ) n_info.
count; k++ ) {
419 printf(
" Register[%2d]: %#08x |%s|\n", k,
422 printf(
" Native Event Description: |%s|\n\n",
427 printf(
"\nPRESET event %s is NOT available on this architecture!\n\n",
name);
431 printf(
"%-30s%s\n%-30s%#-10x\n%-30s%d\n",
432 "Event name:", info.
symbol,
"Event Code:",
433 info.
event_code,
"Number of Register Values:",
435 printf(
"%-29s|%s|\n",
"Description:", info.
long_descr );
436 for ( k = 0; k < (
int ) info.
count; k++ ) {
437 printf(
" Register[%2d]: %#08x |%s|\n", k,
442 if ( !strchr(
name,
':' ) ) {
445 printf(
"\nUnit Masks:\n" );
450 printf(
"%-29s|%s|%s|\n",
451 " Mask Info:", info.
symbol,
453 for ( k = 0; k < (
int ) info.
count;k++ ) {
454 printf(
" Register[%2d]: %#08x |%s|\n",
467 printf(
"Sorry, an event by the name '%s' could not be found.\n"
468 " Is it typed correctly?\n\n",
name );
474 for (
i=0 ;
i<2 ;
i++) {
489 printf(
"================================================================================\n" );
490 printf(
" PAPI Preset Events\n" );
491 printf(
"================================================================================\n" );
494 printf(
"================================================================================\n" );
495 printf(
" User Defined Events\n" );
496 printf(
"================================================================================\n" );
499 if ( print_tabular ) {
500 printf(
" Name Code " );
501 if ( !print_avail_only ) {
504 printf(
"Deriv Description (Note)\n" );
506 printf(
"%-13s%-11s%-8s%-16s\n |Long Description|\n"
507 " |Developer's Notes|\n |Derived|\n |PostFix|\n"
508 " Native Code[n]: <hex> |name|\n",
509 "Symbol",
"Event Code",
"Count",
"|Short Description|" );
513 if ( print_tabular ) {
516 if ( print_avail_only ) {
518 if ( (check_counter &&
checkCounter (event_code)) || !check_counter)
520 printf(
"%-13s%#x %-5s%s",
526 if ( info.
note[0] ) {
527 printf(
" (%s)", info.
note );
531 printf(
"%-13s%#x %-6s%-4s %s",
534 ( info.
count ?
"Yes" :
"No" ),
536 if ( info.
note[0] ) {
537 printf(
" (%s)", info.
note );
543 if ((check_counter &&
checkCounter (event_code)) || !check_counter )
546 if ( !strcmp(
is_derived( &info ),
"Yes" ) ) {
551 if ( ( print_avail_only && info.
count ) ||
552 ( print_avail_only == 0 ) )
554 if ((check_counter &&
checkCounter (event_code)) || !check_counter)
556 printf(
"%s\t%#x\t%d\t|%s|\n |%s|\n"
557 " |%s|\n |%s|\n |%s|\n",
561 for ( j = 0; j < (
int ) info.
count; j++ ) {
562 printf(
" Native Code[%d]: %#x |%s|\n", j,
569 if ((check_counter &&
checkCounter (event_code)) || !check_counter )
572 if ( !strcmp(
is_derived( &info ),
"Yes" ) ) {
581 printf(
"--------------------------------------------------------------------------------\n" );
583 if ( !print_event_info ) {
584 if ( print_avail_only ) {
585 printf(
"Of %d available events, %d ", avail_count, deriv_count );
587 printf(
"Of %d possible events, %d are available, of which %d ",
588 tot_count, avail_count, deriv_count );
590 if ( deriv_count == 1 ) {
591 printf(
"is derived.\n\n" );
593 printf(
"are derived.\n\n" );
596 if (avail_count==0) {
597 printf(
"No events detected! Check papi_component_avail to find out why.\n");
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.
Convert a name to a numeric hardware event code.
Get the event's name and description info.
initialize the PAPI library.
Set the current debug level for error output from PAPI.
#define PAPI_NTV_ENUM_UMASKS
Return codes and api definitions.
#define PAPI_PRESET_BIT_MSC
#define PAPI_PRESET_BIT_CND
#define PAPI_PRESET_BIT_L3
#define PAPI_PRESET_BIT_FP
#define PAPI_PRESET_BIT_INS
#define PAPI_PRESET_BIT_IDL
#define PAPI_PRESET_BIT_TLB
#define PAPI_PRESET_BIT_CACH
#define PAPI_PRESET_BIT_L2
#define PAPI_PRESET_BIT_BR
#define PAPI_PRESET_BIT_L1
int is_preset_event_available(char *name)
static int checkCounter(int eventcode)
static int parse_unit_masks(PAPI_event_info_t *info)
static char * is_derived(PAPI_event_info_t *info)
static void print_help(void)
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
char postfix[PAPI_2MAX_STR_LEN]
char note[PAPI_HUGE_STR_LEN]
char short_descr[PAPI_MIN_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char derived[PAPI_MIN_STR_LEN]
unsigned int code[PAPI_MAX_INFO_TERMS]
char long_descr[PAPI_HUGE_STR_LEN]