diff --git a/src/components/cuda/cupti_event_and_metric.c b/src/components/cuda/cupti_event_and_metric.c index 7cc38ad0a..adda1f247 100644 --- a/src/components/cuda/cupti_event_and_metric.c +++ b/src/components/cuda/cupti_event_and_metric.c @@ -1581,7 +1581,7 @@ int cuptie_evt_code_to_descr(uint32_t event_code, char *descr, int len) * Cuda native event code. * @param modifier * Modifies the search logic. Three modifiers are used PAPI_ENUM_FIRST, - * PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_UMASKS. + * PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_DEFAULT_QUALIFIERS. */ int cuptie_evt_enum(uint32_t *event_code, int modifier) { @@ -1615,7 +1615,7 @@ int cuptie_evt_enum(uint32_t *event_code, int modifier) } papi_errno = PAPI_ENOEVNT; break; - case PAPI_NTV_ENUM_UMASKS: + case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: papi_errno = event_and_metric_id_to_info(*event_code, &info); if (papi_errno != PAPI_OK) { break; diff --git a/src/components/cuda/cupti_profiler.c b/src/components/cuda/cupti_profiler.c index 45e3cd16f..f63bcc096 100644 --- a/src/components/cuda/cupti_profiler.c +++ b/src/components/cuda/cupti_profiler.c @@ -1555,7 +1555,7 @@ static void shutdown_event_stats_table(void) * Cuda native event code. * @param modifier * Modifies the search logic. Three modifiers are used PAPI_ENUM_FIRST, - * PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_UMASKS. + * PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_DEFAULT_QUALIFIERS. */ int cuptip_evt_enum(uint32_t *event_code, int modifier) { @@ -1590,7 +1590,7 @@ int cuptip_evt_enum(uint32_t *event_code, int modifier) } papi_errno = PAPI_ENOEVNT; break; - case PAPI_NTV_ENUM_UMASKS: + case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: papi_errno = evt_id_to_info(*event_code, &info); if (papi_errno != PAPI_OK) { break; diff --git a/src/components/libmsr/linux-libmsr.c b/src/components/libmsr/linux-libmsr.c index 86c42d07a..b15a5b6d7 100644 --- a/src/components/libmsr/linux-libmsr.c +++ b/src/components/libmsr/linux-libmsr.c @@ -829,7 +829,7 @@ int _libmsr_ntv_enum_events( unsigned int *EventCode, int modifier ) return PAPI_ENOEVNT; } break; - // case PAPI_NTV_ENUM_UMASKS: + // case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: default: return PAPI_EINVAL; } diff --git a/src/components/pcp/linux-pcp.c b/src/components/pcp/linux-pcp.c index 5c3ddc248..61ed755b8 100644 --- a/src/components/pcp/linux-pcp.c +++ b/src/components/pcp/linux-pcp.c @@ -1691,7 +1691,7 @@ static int _pcp_set_domain(hwd_control_state_t *ctl, int domain) //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- -// Enumerate events. PAPI_NTV_ENUM_UMASKS has nothing to do; we don't have +// Enumerate events. PAPI_NTV_ENUM_DEFAULT_QUALIFIERS has nothing to do; we don't have // qualifying masks or options on any of our events. //---------------------------------------------------------------------------- @@ -1714,7 +1714,7 @@ static int _pcp_ntv_enum_events(unsigned int *EventCode, int modifier) return PAPI_OK; // And exit. break; // END CASE. - case PAPI_NTV_ENUM_UMASKS: // Note we HAVE no qualifiers or masks. + case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: // Note we HAVE no qualifiers or masks. return PAPI_ENOEVNT; // There are no qualifiers to list. default: // If we don't understand the modifier, diff --git a/src/components/pcp/tests/testPCP.c b/src/components/pcp/tests/testPCP.c index 6b5bc10d1..c043c97e5 100644 --- a/src/components/pcp/tests/testPCP.c +++ b/src/components/pcp/tests/testPCP.c @@ -300,7 +300,7 @@ int main(int argc, char **argv) { // args firstTime = 0; // Don't test the one-time functions again. - } while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_UMASKS,cid)==PAPI_OK); // Get next umask entry (bits different) (should return PAPI_NOEVNT). + } while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_DEFAULT_QUALIFIERS,cid)==PAPI_OK); // Get next qualifier entry (bits different) (should return PAPI_NOEVNT). } while(PAPI_enum_cmp_event(&m,PAPI_ENUM_EVENTS,cid)==PAPI_OK); // Get next event code. // Round 2: Try to load all events into one Event Set. diff --git a/src/components/rocm/roc_profiler.c b/src/components/rocm/roc_profiler.c index cc450f316..aa3e35577 100644 --- a/src/components/rocm/roc_profiler.c +++ b/src/components/rocm/roc_profiler.c @@ -226,7 +226,7 @@ rocp_evt_enum(uint64_t *event_code, int modifier) } papi_errno = PAPI_ENOEVNT; break; - case PAPI_NTV_ENUM_UMASKS: + case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: papi_errno = evt_id_to_info(*event_code, &info); if (papi_errno != PAPI_OK) { break; diff --git a/src/components/rocm_smi/tests/rocm_smi_all.cpp b/src/components/rocm_smi/tests/rocm_smi_all.cpp index faca15fca..7b6b5049f 100644 --- a/src/components/rocm_smi/tests/rocm_smi_all.cpp +++ b/src/components/rocm_smi/tests/rocm_smi_all.cpp @@ -380,7 +380,7 @@ int main(int argc, char *argv[]) if (isString) printf("%-64s: %-64s\n", info.symbol, ((char*) value)); else printf("%-64s: %lli\n", info.symbol, value); } - } while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_UMASKS,cid)==PAPI_OK); // Get next umask entry (bits different) (should return PAPI_NOEVNT). + } while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_DEFAULT_QUALIFIERS,cid)==PAPI_OK); // Get next qualifier entry (bits different) (should return PAPI_NOEVNT). } while(PAPI_enum_cmp_event(&m,PAPI_ENUM_EVENTS,cid)==PAPI_OK); // Get next event code. // fprintf(stderr, "%s:%i Finished Event Loops.\n", __FILE__, __LINE__); diff --git a/src/components/rocp_sdk/sdk_class.cpp b/src/components/rocp_sdk/sdk_class.cpp index c7befa970..2f2050fbf 100644 --- a/src/components/rocp_sdk/sdk_class.cpp +++ b/src/components/rocp_sdk/sdk_class.cpp @@ -941,7 +941,7 @@ evt_enum(unsigned int *event_code, int modifier){ *event_code = tmp_code; break; - case PAPI_NTV_ENUM_UMASKS: + case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: tmp_code = *event_code; { diff --git a/src/components/template/vendor_profiler_v1.c b/src/components/template/vendor_profiler_v1.c index 730cb9903..685c1f2a4 100644 --- a/src/components/template/vendor_profiler_v1.c +++ b/src/components/template/vendor_profiler_v1.c @@ -270,7 +270,7 @@ vendorp1_evt_enum(unsigned int *event_code, int modifier) ++info.nameid; papi_errno = evt_id_create(&info, event_code); break; - case PAPI_NTV_ENUM_UMASKS: + case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: if (info.flags == 0) { info.flags = DEVICE_FLAG; papi_errno = evt_id_create(&info, event_code); diff --git a/src/ctests/all_native_events.c b/src/ctests/all_native_events.c index 5d75a171f..1d60ce60d 100644 --- a/src/ctests/all_native_events.c +++ b/src/ctests/all_native_events.c @@ -184,7 +184,18 @@ main( int argc, char **argv ) /* Enumerate all umasks */ k = i; - if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK ) { + + int modifier = -1; + // For the CPU components, we enumerate through umasks + if (PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK) { + modifier = PAPI_NTV_ENUM_UMASKS; + } + // For the non-cpu components, we enumerate through qualifiers + else if (PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cid)==PAPI_OK) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { do { retval = PAPI_get_event_info( k, &info1 ); event_code = ( int ) info1.event_code; @@ -194,7 +205,7 @@ main( int argc, char **argv ) else { err_count++; } - } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ); + } while ( PAPI_enum_cmp_event( &k, modifier, cid ) == PAPI_OK ); } } while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK ); diff --git a/src/ctests/failed_events.c b/src/ctests/failed_events.c index f7e7aae51..b947a17a0 100644 --- a/src/ctests/failed_events.c +++ b/src/ctests/failed_events.c @@ -154,56 +154,59 @@ main( int argc, char **argv ) do { retval = PAPI_get_event_info( i, &info ); - k = i; - if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK ) { - do { - retval = PAPI_get_event_info( k, &info1 ); - - - - /* Skip perf_raw event as it is hard to error out */ - if (strstr(info1.symbol,"perf_raw")) { - break; - } - -// printf("%s\n",info1.symbol); - - if (strlen(info1.symbol)>5) { - info1.symbol[strlen(info1.symbol)-4]^=0xa5; - - retval=PAPI_add_named_event(EventSet,info1.symbol); - if (retval==PAPI_OK) { - if (!quiet) { - printf("Unexpectedly opened %s!\n", - info1.symbol); - err_count++; - } + k = i; + int modifier = -1; + // For the CPU components, we enumerate through umasks + if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK ) { + modifier = PAPI_NTV_ENUM_UMASKS; } - } - } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ); - } else { - /* Event didn't have any umasks */ - - // PROBLEM: info1 is NOT initialized by anyone! - // Original code referenced info1, changed to info. [Tony C. 11-27-19] -// printf("%s\n",info.symbol); - if (strlen(info.symbol)>5) { - info.symbol[strlen(info.symbol)-4]^=0xa5; - - retval=PAPI_add_named_event(EventSet,info.symbol); - if (retval==PAPI_OK) { - if (!quiet) { - printf("Unexpectedly opened %s!\n", - info.symbol); - err_count++; + // For the non-cpu components, we enumerate through qualifiers + else if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cid )==PAPI_OK ) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { + do { + retval = PAPI_get_event_info( k, &info1 ); + /* Skip perf_raw event as it is hard to error out */ + if (strstr(info1.symbol,"perf_raw")) { + break; + } + + if (strlen(info1.symbol)>5) { + info1.symbol[strlen(info1.symbol)-4]^=0xa5; + retval=PAPI_add_named_event(EventSet,info1.symbol); + if (retval==PAPI_OK) { + if (!quiet) { + printf("Unexpectedly opened %s!\n", info1.symbol); + err_count++; + } + } + } + } while ( PAPI_enum_cmp_event( &k, modifier, cid ) == PAPI_OK ); + } + else { + /* Event didn't have any umasks */ + + // PROBLEM: info1 is NOT initialized by anyone! + // Original code referenced info1, changed to info. [Tony C. 11-27-19] + // printf("%s\n",info.symbol); + if (strlen(info.symbol)>5) { + info.symbol[strlen(info.symbol)-4]^=0xa5; + + retval=PAPI_add_named_event(EventSet,info.symbol); + if (retval==PAPI_OK) { + if (!quiet) { + printf("Unexpectedly opened %s!\n", info.symbol); + err_count++; + } + } } } - } - } - } while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK ); + } while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK ); - } + } diff --git a/src/papi.c b/src/papi.c index 8aff08061..3b1e24a4e 100644 --- a/src/papi.c +++ b/src/papi.c @@ -1747,6 +1747,8 @@ PAPI_event_name_to_code( const char *in, int *out ) *
  • PAPI_NTV_ENUM_UMASK_COMBOS -- Given an event, iterate * through all possible combinations of umasks. * This is not implemented on libpfm4. + *
  • PAPI_NTV_ENUM_DEFAULT_QUALIFIERS -- Given an event, iterate through + * its default qualifiers. * * * @par Preset Modifiers @@ -1788,7 +1790,8 @@ PAPI_enum_event( int *EventCode, int modifier ) modifier != PAPI_PRESET_ENUM_CPU_AVAIL && modifier != PAPI_PRESET_ENUM_FIRST_COMP && modifier != PAPI_NTV_ENUM_UMASKS && - modifier != PAPI_NTV_ENUM_UMASK_COMBOS) + modifier != PAPI_NTV_ENUM_UMASK_COMBOS && + modifier != PAPI_NTV_ENUM_DEFAULT_QUALIFIERS) { return PAPI_EINVAL; } diff --git a/src/papi.h b/src/papi.h index 8ec8c7e47..6380a755a 100644 --- a/src/papi.h +++ b/src/papi.h @@ -511,6 +511,7 @@ enum { /* PAPI native event related section */ PAPI_NTV_ENUM_UMASKS, /**< all individual bits for given group */ PAPI_NTV_ENUM_UMASK_COMBOS, /**< all combinations of mask bits for given group */ + PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, /**< Enumerate through an events default qualifiers */ PAPI_NTV_ENUM_IARR, /**< Enumerate events that support IAR (instruction address ranging) */ PAPI_NTV_ENUM_DARR, /**< Enumerate events that support DAR (data address ranging) */ PAPI_NTV_ENUM_OPCM, /**< Enumerate events that support OPC (opcode matching) */ diff --git a/src/utils/papi_avail.c b/src/utils/papi_avail.c index b3150beff..955cf3987 100644 --- a/src/utils/papi_avail.c +++ b/src/utils/papi_avail.c @@ -447,81 +447,96 @@ main( int argc, char **argv ) /* Code for info on just one event */ if ( print_event_info ) { + if ( PAPI_event_name_to_code( name, &event_code ) == PAPI_OK ) { + if ( PAPI_get_event_info( event_code, &info ) == PAPI_OK ) { + if ( event_code & PAPI_PRESET_MASK ) { + printf( "%-30s%s\n%-30s%#-10x\n%-30s%d\n", + "Event name:", info.symbol, "Event Code:", + info.event_code, "Number of Native Events:", + info.count ); + + printf( "%-29s|%s|\n%-29s|%s|\n%-29s|%s|\n", + "Short Description:", info.short_descr, + "Long Description:", info.long_descr, + "Developer's Notes:", info.note ); + + printf( "%-29s|%s|\n%-29s|%s|\n", "Derived Type:", + info.derived, "Postfix Processing String:", + info.postfix ); + + for( j = 0; j < ( int ) info.count; j++ ) { + printf( " Native Code[%d]: %#x |%s|\n", j, + info.code[j], info.name[j] ); + + PAPI_get_event_info( (int) info.code[j], &n_info ); + + printf(" Number of Register Values: %d\n", n_info.count ); + + for( k = 0; k < ( int ) n_info.count; k++ ) { + printf( " Register[%2d]: %#08x |%s|\n", k, + n_info.code[k], n_info.name[k] ); + } + printf( " Native Event Description: |%s|\n\n", + n_info.long_descr ); + } + + if (!is_preset_event_available(name)) { + printf("\nPRESET event %s is NOT available on this architecture!\n\n", name); + } + } + else { /* must be a native event code */ + printf( "%-30s%s\n%-30s%#-10x\n%-30s%d\n", + "Event name:", info.symbol, "Event Code:", + info.event_code, "Number of Register Values:", + info.count ); + printf( "%-29s|%s|\n", "Description:", info.long_descr ); + + for ( k = 0; k < ( int ) info.count; k++ ) { + printf( " Register[%2d]: %#08x |%s|\n", k, + info.code[k], info.name[k] ); + } - if ( PAPI_event_name_to_code( name, &event_code ) == PAPI_OK ) { - if ( PAPI_get_event_info( event_code, &info ) == PAPI_OK ) { - - if ( event_code & PAPI_PRESET_MASK ) { - printf( "%-30s%s\n%-30s%#-10x\n%-30s%d\n", - "Event name:", info.symbol, "Event Code:", - info.event_code, "Number of Native Events:", - info.count ); - printf( "%-29s|%s|\n%-29s|%s|\n%-29s|%s|\n", - "Short Description:", info.short_descr, - "Long Description:", info.long_descr, - "Developer's Notes:", info.note ); - printf( "%-29s|%s|\n%-29s|%s|\n", "Derived Type:", - info.derived, "Postfix Processing String:", - info.postfix ); - - for( j = 0; j < ( int ) info.count; j++ ) { - printf( " Native Code[%d]: %#x |%s|\n", j, - info.code[j], info.name[j] ); - PAPI_get_event_info( (int) info.code[j], &n_info ); - printf(" Number of Register Values: %d\n", n_info.count ); - for( k = 0; k < ( int ) n_info.count; k++ ) { - printf( " Register[%2d]: %#08x |%s|\n", k, - n_info.code[k], n_info.name[k] ); - } - printf( " Native Event Description: |%s|\n\n", - n_info.long_descr ); - } - - if (!is_preset_event_available(name)) { - printf("\nPRESET event %s is NOT available on this architecture!\n\n", name); - } - - } else { /* must be a native event code */ - printf( "%-30s%s\n%-30s%#-10x\n%-30s%d\n", - "Event name:", info.symbol, "Event Code:", - info.event_code, "Number of Register Values:", - info.count ); - printf( "%-29s|%s|\n", "Description:", info.long_descr ); - for ( k = 0; k < ( int ) info.count; k++ ) { - printf( " Register[%2d]: %#08x |%s|\n", k, - info.code[k], info.name[k] ); - } - - /* if unit masks exist but none are specified, process all */ - if ( !strchr( name, ':' ) ) { - if ( 1 ) { - if ( PAPI_enum_event( &event_code, PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ) { - printf( "\nUnit Masks:\n" ); - do { - retval = PAPI_get_event_info(event_code, &info ); - if ( retval == PAPI_OK ) { - if ( parse_unit_masks( &info ) ) { - printf( "%-29s|%s|%s|\n", - " Mask Info:", info.symbol, - info.long_descr ); - for ( k = 0; k < ( int ) info.count;k++ ) { - printf( " Register[%2d]: %#08x |%s|\n", - k, info.code[k], info.name[k] ); - } - } + if ( !strchr( name, ':' ) ) { + if ( 1 ) { + int modifier = -1; + // For the CPU components, we enumerate through umasks + if ( PAPI_enum_event( &event_code, PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_UMASKS; + } + // For the non-cpu components, we enumerate through qualifiers + else if ( PAPI_enum_event( &event_code, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { + printf( "\nUnit Masks:\n" ); + do { + retval = PAPI_get_event_info(event_code, &info ); + if ( retval == PAPI_OK ) { + if ( parse_unit_masks( &info ) ) { + printf( "%-29s|%s|%s|\n", + " Mask Info:", info.symbol, + info.long_descr ); + + for ( k = 0; k < ( int ) info.count;k++ ) { + printf( " Register[%2d]: %#08x |%s|\n", + k, info.code[k], info.name[k] ); + } + } + } + } while ( PAPI_enum_event( &event_code, modifier ) == PAPI_OK ); + } + } + } } - } while ( PAPI_enum_event( &event_code, - PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ); - } - } + } } - } - } - } else { - printf( "Sorry, an event by the name '%s' could not be found.\n" - " Is it typed correctly?\n\n", name ); - } - } else { + else { + printf( "Sorry, an event by the name '%s' could not be found.\n" + " Is it typed correctly?\n\n", name ); + } + } + else { /* Print *ALL* Events */ diff --git a/src/utils/papi_event_chooser.c b/src/utils/papi_event_chooser.c index 646b663fb..0cc98a703 100644 --- a/src/utils/papi_event_chooser.c +++ b/src/utils/papi_event_chooser.c @@ -99,28 +99,37 @@ native( int cidx ) } do { - k = i; - - if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cidx) == PAPI_OK ) { - if ( ( added = add_remove_event( EventSet, k ) ) == PAPI_OK ) { - show_event_info( i ); - do { - retval = PAPI_get_event_info( k, &info ); - if ( retval == PAPI_OK ) { - printf( " %#-10x%s |%s|\n", info.event_code, - strchr( info.symbol, ':' ), - strchr( info.long_descr, ':' ) + 1 ); - } - } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cidx ) == - PAPI_OK ); - j++; - } - } else { - if ( ( added = add_remove_event( EventSet, i ) ) == PAPI_OK ) { - show_event_info( i ); - j++; - } - } + k = i; + int modifier = -1; + // For the CPU components, we enumerate through umasks + if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cidx) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_UMASKS; + } + // For the non-cpu components, we enumerate through qualifiers + else if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cidx) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { + if ( ( added = add_remove_event( EventSet, k ) ) == PAPI_OK ) { + show_event_info( i ); + do { + retval = PAPI_get_event_info( k, &info ); + if ( retval == PAPI_OK ) { + printf( " %#-10x%s |%s|\n", info.event_code, + strchr( info.symbol, ':' ), + strchr( info.long_descr, ':' ) + 1 ); + } + } while ( PAPI_enum_cmp_event( &k, modifier, cidx ) == PAPI_OK ); + j++; + } + } + else { + if ( ( added = add_remove_event( EventSet, i ) ) == PAPI_OK ) { + show_event_info( i ); + j++; + } + } if ( added == PAPI_OK ) { /* modifier = PAPI_NTV_ENUM_GROUPS returns event codes with a diff --git a/src/utils/papi_native_avail.c b/src/utils/papi_native_avail.c index a71447c32..c9d9949c9 100644 --- a/src/utils/papi_native_avail.c +++ b/src/utils/papi_native_avail.c @@ -547,17 +547,27 @@ main( int argc, char **argv ) /* if event qualifiers exist but none specified, process all */ if ( !strchr( ptr, ':' ) ) { - if ( PAPI_enum_event( &i, PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ) { - printf( "\nQualifiers: Name -- Description\n" ); - do { - retval = PAPI_get_event_info( i, &info ); - if ( retval == PAPI_OK ) { - if ( parse_event_qualifiers( &info ) ) { - printf( " Info: %10s -- %s\n", info.symbol, info.long_descr ); - } - } - } while ( PAPI_enum_event( &i, PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ); - } + int modifier = -1; + // For the CPU components, we enumerate through umasks + if ( PAPI_enum_event( &i, PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_UMASKS; + } + // For the non-cpu components, we enumerate through qualifiers + else if ( PAPI_enum_event( &i, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { + printf( "\nQualifiers: Name -- Description\n" ); + do { + retval = PAPI_get_event_info( i, &info ); + if ( retval == PAPI_OK ) { + if ( parse_event_qualifiers( &info ) ) { + printf( " Info: %10s -- %s\n", info.symbol, info.long_descr ); + } + } + } while ( PAPI_enum_event( &i, modifier ) == PAPI_OK ); + } } } } else { @@ -652,10 +662,19 @@ main( int argc, char **argv ) if (flags.qualifiers || flags.check){ k = i; + int modifier = -1; + // For the CPU components, we enumerate through umasks if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_UMASKS; + } + // For the non-cpu components, we enumerate through qualifiers + else if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cid) == PAPI_OK) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { // clear event string using first mask char first_event_mask_string[PAPI_HUGE_STR_LEN] = ""; - do { retval = PAPI_get_event_info( k, &info ); if ( retval == PAPI_OK ) { @@ -673,7 +692,8 @@ main( int argc, char **argv ) format_event_output( &info, 2); } } - } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ); + } while ( PAPI_enum_cmp_event( &k, modifier, cid ) == PAPI_OK ); + // if we are validating events and the event_available flag is not set yet, try a few more combinations if (flags.check && (event_available == 0)) { // try using the event with the first mask defined for the event and the cpu mask diff --git a/src/utils/papi_xml_event_info.c b/src/utils/papi_xml_event_info.c index c024cc036..2299408fd 100644 --- a/src/utils/papi_xml_event_info.c +++ b/src/utils/papi_xml_event_info.c @@ -204,52 +204,58 @@ enum_preset_events( FILE * f, int cidx) static void enum_native_events( FILE * f, int cidx) { - int i, k, num; - int retval; - PAPI_event_info_t info; - - i = PAPI_NATIVE_MASK; - fprintf( f, " \n" ); - num = -1; - retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_FIRST, cidx ); - - while ( retval == PAPI_OK ) { - - num++; - retval = PAPI_get_event_info( i, &info ); - if ( retval != PAPI_OK ) { - retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cidx ); - continue; - } - - /* enumerate any umasks */ - k = i; - if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cidx ) == PAPI_OK ) { - - /* add the event */ - xmlize_event( f, &info, num ); - - /* add the event's unit masks */ - do { - retval = PAPI_get_event_info( k, &info ); - if ( retval == PAPI_OK ) { - if ( test_event( k )!=PAPI_OK ) { - continue; - } - xmlize_event( f, &info, -1 ); - } - } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cidx ) == PAPI_OK); - fprintf( f, " \n" ); - } else { - /* this event has no unit masks; test & write the event */ - if ( test_event( i ) == PAPI_OK ) { - xmlize_event( f, &info, num ); - fprintf( f, " \n" ); - } - } - retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cidx ); - } - fprintf( f, " \n" ); + int i = PAPI_NATIVE_MASK; + fprintf( f, " \n" ); + int num = -1; + int retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_FIRST, cidx ); + + while ( retval == PAPI_OK ) { + num++; + PAPI_event_info_t info; + retval = PAPI_get_event_info( i, &info ); + if ( retval != PAPI_OK ) { + retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cidx ); + continue; + } + + // Enumerate any default qualifiers or umasks + int modifier = -1; + int k = i; + // For the CPU components, we enumerate through umasks + if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cidx ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_UMASKS; + } + // For the non-cpu components, we enumerate through qualifiers + else if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cidx ) == PAPI_OK ) { + modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS; + } + + if (modifier != -1) { + // Add the event + xmlize_event( f, &info, num ); + + // Add the event's default qualifiers or umasks add the event's unit masks + do { + retval = PAPI_get_event_info( k, &info ); + if ( retval == PAPI_OK ) { + if ( test_event( k )!=PAPI_OK ) { + continue; + } + xmlize_event( f, &info, -1 ); + } + } while ( PAPI_enum_cmp_event( &k, modifier, cidx ) == PAPI_OK); + fprintf( f, " \n" ); + } + else { + // This event has no default qualifiers or umasks + if ( test_event( i ) == PAPI_OK ) { + xmlize_event( f, &info, num ); + fprintf( f, " \n" ); + } + } + retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cidx ); + } + fprintf( f, " \n" ); } /****************************************/