diff --git a/papi-man.patch b/papi-man.patch new file mode 100644 index 0000000..941c842 --- /dev/null +++ b/papi-man.patch @@ -0,0 +1,302 @@ +commit f10342a88c4b591b80444b5e2ff8ec063ef58fa4 +Author: William Cohen +Date: Mon Jul 1 16:12:23 2013 -0400 + + Clean up option handling in papi_cost + + The papi_cost used strstr to seach for the substring that matched the + option. this is pretty inexact. Made sure that the options matched + exactly and the option argments for -b and -t were greater than 0. + Also make papi_cost print out the help if there was an option that it + didn't understand. + + Signed-off-by: William Cohen + +diff --git a/src/utils/cost.c b/src/utils/cost.c +index 44b338d..5f7aa54 100644 +--- a/src/utils/cost.c ++++ b/src/utils/cost.c +@@ -182,35 +182,34 @@ main( int argc, char **argv ) + + tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ + +- for ( i = 0; i < argc; i++ ) { +- if ( argv[i] ) { +- if ( strstr( argv[i], "-b" ) ) { +- bins = atoi( argv[i + 1] ); +- if ( bins ) +- i++; +- else { +- printf( "-b requires a bin count!\n" ); +- exit( 1 ); +- } +- } +- if ( strstr( argv[i], "-d" ) ) +- show_dist = 1; +- if ( strstr( argv[i], "-h" ) ) { +- print_help( ); ++ for ( i = 1; i < argc; i++ ) { ++ if ( !strcmp( argv[i], "-b" ) ) { ++ i++; ++ if ( i >= argc || (bins = atoi( argv[i] ) > 0 ) ) { ++ printf( "-b requires a positive bin count!\n" ); + exit( 1 ); + } +- if ( strstr( argv[i], "-s" ) ) +- show_std_dev = 1; +- if ( strstr( argv[i], "-t" ) ) { +- num_iters = ( int ) atol( argv[i + 1] ); +- if ( num_iters ) +- i++; +- else { +- printf( "-t requires a threshold value!\n" ); +- exit( 1 ); +- } ++ } ++ else if ( !strcmp( argv[i], "-d" ) ) ++ show_dist = 1; ++ else if ( !strcmp( argv[i], "-h" ) ) { ++ print_help( ); ++ exit( 1 ); ++ } ++ else if ( !strcmp( argv[i], "-s" ) ) ++ show_std_dev = 1; ++ else if ( !strcmp( argv[i], "-t" ) ) { ++ i++; ++ if ( i >= argc || (num_iters = ( int ) atol( argv[i] ) > 0) ) { ++ printf( "-t requires a positive threshold value!\n" ); ++ exit( 1 ); + } + } ++ else { ++ /* If not a valid option, print out some help information */ ++ print_help( ); ++ exit( 1 ); ++ } + } + + printf( "Cost of execution for PAPI start/stop, read and accum.\n" ); + +commit b5adc5614855fbd024fc5d5cd73a0305c87af5aa +Author: William Cohen +Date: Mon Jul 1 16:12:25 2013 -0400 + + Clean up option handling for papi_native_avail + + Corrected the help to reflect the name of the option "--noumasks". + Print error message if the "-i", "-e", and "-x" option arguments are invalid. + Avoid using strstr() for "-h", use strcmp instead. + Also check for "--help" option. + + Signed-off-by: William Cohen + +diff --git a/src/utils/native_avail.c b/src/utils/native_avail.c +index 5c303da..dcd4d99 100644 +--- a/src/utils/native_avail.c ++++ b/src/utils/native_avail.c +@@ -23,7 +23,7 @@ + *
  • -e EVENTNAME display detailed information about named native event + *
  • -i EVENTSTR include only event names that contain EVENTSTR + *
  • -x EVENTSTR exclude any event names that contain EVENTSTR +- *
  • --nomasks suppress display of Unit Mask information ++ *
  • --noumasks suppress display of Unit Mask information + * + * + * Processor-specific options +@@ -75,7 +75,7 @@ print_help( char **argv ) + printf( " -e EVENTNAME display detailed information about named native event\n" ); + printf( " -i EVENTSTR include only event names that contain EVENTSTR\n" ); + printf( " -x EVENTSTR exclude any event names that contain EVENTSTR\n" ); +- printf( " --nomasks suppress display of Unit Mask information\n" ); ++ printf( " --noumasks suppress display of Unit Mask information\n" ); + printf( "\nProcessor-specific options\n"); + printf( " --darr display events supporting Data Address Range Restriction\n" ); + printf( " --dear display Data Event Address Register events only\n" ); +@@ -122,20 +122,29 @@ parse_args( int argc, char **argv, command_flags_t * f ) + f->details = 1; + else if ( !strcmp( argv[i], "-e" ) ) { + f->named = 1; +- f->name = argv[i + 1]; +- if ( no_str_arg( f->name ) ) f->help = 1; + i++; ++ f->name = argv[i]; ++ if ( i >= argc || no_str_arg( f->name ) ) { ++ printf( "Invalid argument for -e\n"); ++ exit(1); ++ } + } else if ( !strcmp( argv[i], "-i" ) ) { + f->include = 1; +- f->istr = argv[i + 1]; +- if ( no_str_arg( f->istr ) ) f->help = 1; + i++; ++ f->istr = argv[i]; ++ if ( i >= argc || no_str_arg( f->istr ) ) { ++ printf( "Invalid argument for -i\n"); ++ exit(1); ++ } + } else if ( !strcmp( argv[i], "-x" ) ) { + f->xclude = 1; +- f->xstr = argv[i + 1]; +- if ( no_str_arg( f->xstr ) ) f->help = 1; + i++; +- } else if ( strstr( argv[i], "-h" ) ) ++ f->xstr = argv[i]; ++ if ( i >= argc || no_str_arg( f->xstr ) ) { ++ printf( "Invalid argument for -x\n"); ++ exit(1); ++ } ++ } else if ( !strcmp( argv[i], "-h" ) || !strcmp( argv[i], "--help" ) ) + f->help = 1; + else { + printf( "%s is not supported\n", argv[i] ); + +commit 8933be9b144bba5e98be892452c7eb44cedbf2af +Author: William Cohen +Date: Mon Jul 1 16:12:24 2013 -0400 + + Clean up option handling in papi_decode + + papi_decode used strstr() to match options; this can lead to inexact + matchs. The code should used strcmp instead. Make sure command name + is not processed as an option. Also print help iformation is some + argument is not understood. + + Signed-off-by: William Cohen + +diff --git a/src/utils/decode.c b/src/utils/decode.c +index 3ab7607..ce7cef8 100644 +--- a/src/utils/decode.c ++++ b/src/utils/decode.c +@@ -66,11 +66,14 @@ main( int argc, char **argv ) + PAPI_event_info_t info; + + tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ +- for ( i = 0; i < argc; i++ ) ++ for ( i = 1; i < argc; i++ ) + if ( argv[i] ) { +- if ( strstr( argv[i], "-a" ) ) ++ if ( !strcmp( argv[i], "-a" ) ) + print_avail_only = PAPI_PRESET_ENUM_AVAIL; +- if ( strstr( argv[i], "-h" ) ) { ++ else if ( !strcmp( argv[i], "-h" ) ) { ++ print_help( ); ++ exit( 1 ); ++ } else { + print_help( ); + exit( 1 ); + } + +commit d94ac43aee03c03abf143bdc0f62f704e2c26f99 +Author: William Cohen +Date: Mon Jul 1 16:12:22 2013 -0400 + + Improve option matching in papi_component and add "--help" option + + Signed-off-by: William Cohen + +diff --git a/src/utils/component.c b/src/utils/component.c +index 6eb6a11..e69872b 100644 +--- a/src/utils/component.c ++++ b/src/utils/component.c +@@ -55,7 +55,7 @@ parse_args( int argc, char **argv, command_flags_t * f ) + for ( i = 1; i < argc; i++ ) { + if ( !strcmp( argv[i], "-d" ) ) { + f->details = 1; +- } else if ( strstr( argv[i], "-h" ) ) ++ } else if ( !strcmp( argv[i], "-h" ) || !strcmp( argv[i], "--help" ) ) + f->help = 1; + else + printf( "%s is not supported\n", argv[i] ); + +commit bb63fe5c270fc970d4fc1a592369472b03d1a928 +Author: William Cohen +Date: Mon Jul 1 16:12:21 2013 -0400 + + Add options to papi_command_line man page and improve opt handling + + Add options mention in the -h to the man page. Also improve the matching + of the options. + + Signed-off-by: William Cohen + +diff --git a/src/utils/command_line.c b/src/utils/command_line.c +index 8eb995a..7fecc07 100644 +--- a/src/utils/command_line.c ++++ b/src/utils/command_line.c +@@ -17,7 +17,11 @@ + * and if they give reasonable results for known work. + * + * @section Options +- * This utility has no command line options. ++ *
      ++ *
    • -u Display output values as unsigned integers ++ *
    • -x Display output values as hexadecimal ++ *
    • -h Display help information about this utility. ++ *
    + * + * @section Bugs + * There are no known bugs in this utility. +@@ -78,12 +82,12 @@ main( int argc, char **argv ) + test_fail_exit( __FILE__, __LINE__, "malloc", PAPI_ESYS ); + + for ( num_events = 0, i = 1; i < argc; i++ ) { +- if ( strstr( argv[i], "-h" ) ) { ++ if ( !strcmp( argv[i], "-h" ) ) { + print_help( argv ); + exit( 1 ); +- } else if ( strstr( argv[i], "-u" ) ) { ++ } else if ( !strcmp( argv[i], "-u" ) ) { + u_format = 1; +- } else if ( strstr( argv[i], "-x" ) ) { ++ } else if ( !strcmp( argv[i], "-x" ) ) { + hex_format = 1; + } else { + if ( ( retval = PAPI_add_named_event( EventSet, argv[i] ) ) != PAPI_OK ) { + +commit 09059c8223e43c2aaa13aafda094d30a8b220321 +Author: William Cohen +Date: Mon Jul 1 16:12:20 2013 -0400 + + Add information for papi_version to be complete + + Signed-off-by: William Cohen + +diff --git a/doc/Makefile b/doc/Makefile +index 98d1733..7b52a23 100644 +--- a/doc/Makefile ++++ b/doc/Makefile +@@ -11,7 +11,7 @@ man: man/man1 man/man3 + man/man3: ../src/papi.h + doxygen Doxyfile-man3 + +-man/man1: ../src/utils/avail.c ../src/utils/clockres.c ../src/utils/command_line.c ../src/utils/component.c ../src/utils/cost.c ../src/utils/decode.c ../src/utils/error_codes.c ../src/utils/event_chooser.c ../src/utils/event_info.c ../src/utils/mem_info.c ../src/utils/multiplex_cost.c ../src/utils/native_avail.c ++man/man1: ../src/utils/avail.c ../src/utils/clockres.c ../src/utils/command_line.c ../src/utils/component.c ../src/utils/cost.c ../src/utils/decode.c ../src/utils/error_codes.c ../src/utils/event_chooser.c ../src/utils/event_info.c ../src/utils/mem_info.c ../src/utils/multiplex_cost.c ../src/utils/native_avail.c ../src/utils/version.c + doxygen Doxyfile-man1 + + clean: +diff --git a/src/utils/version.c b/src/utils/version.c +index 231f1cc..43932fb 100644 +--- a/src/utils/version.c ++++ b/src/utils/version.c +@@ -1,3 +1,21 @@ ++/** ++ * file version.c ++ * @brief papi_version utility. ++ * @page papi_version ++ * @section Name ++ * papi_version - provides version information for papi. ++ * ++ * @section Synopsis ++ * papi_version ++ * ++ * @section Description ++ * papi_version is a PAPI utility program that reports version ++ * information about the current PAPI installation. ++ * ++ * @section Bugs ++ * There are no known bugs in this utility. ++ * If you find a bug, it should be reported to the PAPI Mailing List at . ++ */ + /* This utility displays the current PAPI version number */ + + #include diff --git a/papi-native-option.patch b/papi-native-option.patch new file mode 100644 index 0000000..c6097cc --- /dev/null +++ b/papi-native-option.patch @@ -0,0 +1,238 @@ +commit 2e6bcb2a4291f9ae66a4cd44ddec2375723fb1b8 +Author: Dan Terpstra +Date: Thu May 2 14:19:43 2013 -0400 + + Add two command line switches: + -i EVENTSTR includes only events whose names contain EVENTSTR; + -x EVENTSTR excludes all events whose names contain EVENTSTR. + + These two switches can be combined, but only one string per switch can be used. + This allows you to, for example, filter events by component name, or eliminate all uncore events on Sandy Bridge… + +diff --git a/src/utils/native_avail.c b/src/utils/native_avail.c +index 1c16d73..825bd19 100644 +--- a/src/utils/native_avail.c ++++ b/src/utils/native_avail.c +@@ -18,10 +18,12 @@ + * + * @section Options + *
      +- *
    • --help, -h print this help message +- *
    • -d display detailed information about native events +- *
    • -e EVENTNAME display detail information about named native event +- *
    • --nomasks suppress display of Unit Mask information ++ *
    • --help, -h print this help message ++ *
    • -d display detailed information about native events ++ *
    • -e EVENTNAME display detailed information about named native event ++ *
    • -i EVENTSTR include only event names that contain EVENTSTR ++ *
    • -x EVENTSTR exclude any event names that contain EVENTSTR ++ *
    • --nomasks suppress display of Unit Mask information + *
    + * + * Processor-specific options +@@ -49,7 +51,9 @@ typedef struct command_flags + int help; + int details; + int named; +- char *name; ++ int include; ++ int xclude; ++ char *name, *istr, *xstr; + int darr; + int dear; + int iarr; +@@ -60,7 +64,7 @@ typedef struct command_flags + } command_flags_t; + + static void +-print_help( char **argv) ++print_help( char **argv ) + { + printf( "This is the PAPI native avail program.\n" ); + printf( "It provides availability and detail information for PAPI native events.\n" ); +@@ -68,18 +72,26 @@ print_help( char **argv) + printf( "\nOptions:\n" ); + printf( " --help, -h print this help message\n" ); + printf( " -d display detailed information about native events\n" ); +- printf( " -e EVENTNAME display detail information about named native event\n" ); ++ printf( " -e EVENTNAME display detailed information about named native event\n" ); ++ printf( " -i EVENTSTR include only event names that contain EVENTSTR\n" ); ++ printf( " -x EVENTSTR exclude any event names that contain EVENTSTR\n" ); + printf( " --nomasks suppress display of Unit Mask information\n" ); + printf( "\nProcessor-specific options\n"); + printf( " --darr display events supporting Data Address Range Restriction\n" ); + printf( " --dear display Data Event Address Register events only\n" ); + printf( " --iarr display events supporting Instruction Address Range Restriction\n" ); + printf( " --iear display Instruction Event Address Register events only\n" ); +- printf( " --opcm display events supporting OpCode Matching\n" ); ++ printf( " --opcm display events supporting OpCode Matching\n" ); + printf( " --nogroups suppress display of Event grouping information\n" ); + printf( "\n" ); + } + ++static int ++no_str_arg( char *arg ) ++{ ++ return ( ( arg == NULL ) || ( strlen( arg ) == 0 ) || ( arg[0] == '-' ) ); ++} ++ + static void + parse_args( int argc, char **argv, command_flags_t * f ) + { +@@ -111,8 +123,17 @@ parse_args( int argc, char **argv, command_flags_t * f ) + else if ( !strcmp( argv[i], "-e" ) ) { + f->named = 1; + f->name = argv[i + 1]; +- if ( ( f->name == NULL ) || ( strlen( f->name ) == 0 ) || ( f->name[0] == '-' ) ) +- f->help = 1; ++ if ( no_str_arg( f->name ) ) f->help = 1; ++ i++; ++ } else if ( !strcmp( argv[i], "-i" ) ) { ++ f->include = 1; ++ f->istr = argv[i + 1]; ++ if ( no_str_arg( f->istr ) ) f->help = 1; ++ i++; ++ } else if ( !strcmp( argv[i], "-x" ) ) { ++ f->xclude = 1; ++ f->xstr = argv[i + 1]; ++ if ( no_str_arg( f->xstr ) ) f->help = 1; + i++; + } else if ( strstr( argv[i], "-h" ) ) + f->help = 1; +@@ -243,7 +264,7 @@ main( int argc, char **argv ) + } + + +- /* Do this code if an event name was specified on the commandline */ ++ /* Do this code if the event name option was specified on the commandline */ + if ( flags.named ) { + if ( PAPI_event_name_to_code( flags.name, &i ) == PAPI_OK ) { + if ( PAPI_get_event_info( i, &info ) == PAPI_OK ) { +@@ -274,11 +295,10 @@ main( int argc, char **argv ) + exit( 1 ); + } + } +- else { ++ else { + + /* Print *ALL* available events */ + +- + numcmp = PAPI_num_components( ); + + j = 0; +@@ -302,24 +322,35 @@ main( int argc, char **argv ) + retval=PAPI_enum_cmp_event( &i, PAPI_ENUM_FIRST, cid ); + + do { +- memset( &info, 0, sizeof ( info ) ); +- retval = PAPI_get_event_info( i, &info ); ++ memset( &info, 0, sizeof ( info ) ); ++ retval = PAPI_get_event_info( i, &info ); + +- /* This event may not exist */ +- if ( retval != PAPI_OK ) +- continue; ++ /* This event may not exist */ ++ if ( retval != PAPI_OK ) ++ continue; + +- /* count only events that as supported by host cpu */ +- j++; ++ /* Bail if event name doesn't contain include string */ ++ if ( flags.include ) { ++ if ( !strstr( info.symbol, flags.istr ) ) { ++ continue; ++ } ++ } + +- print_event( &info, 0 ); ++ /* Bail if event name does contain exclude string */ ++ if ( flags.xclude ) { ++ if ( strstr( info.symbol, flags.xstr ) ) ++ continue; ++ } ++ ++ /* count only events that are actually processed */ ++ j++; + +- if (flags.details) { +- if (info.units[0]) printf( "| Units: %-67s|\n", +- info.units ); +- } +- ++ print_event( &info, 0 ); + ++ if (flags.details) { ++ if (info.units[0]) printf( "| Units: %-67s|\n", ++ info.units ); ++ } + + /* modifier = PAPI_NTV_ENUM_GROUPS returns event codes with a + groups id for each group in which this +@@ -327,36 +358,36 @@ main( int argc, char **argv ) + terminating with PAPI_ENOEVNT at the end of the list. + */ + +- /* This is an IBM Power issue */ +- if ( flags.groups ) { +- k = i; +- if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_GROUPS, cid ) == PAPI_OK ) { +- printf( "Groups: " ); +- do { +- printf( "%4d", ( ( k & PAPI_NTV_GROUP_AND_MASK ) >> +- PAPI_NTV_GROUP_SHIFT ) - 1 ); +- } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_GROUPS, cid ) ==PAPI_OK ); +- printf( "\n" ); +- } +- } +- +- /* Print umasks */ +- /* components that don't have them can just ignore */ +- +- if ( flags.umask ) { +- k = i; +- if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ) { +- do { +- retval = PAPI_get_event_info( k, &info ); +- if ( retval == PAPI_OK ) { +- if ( parse_unit_masks( &info ) ) +- print_event( &info, 2 ); +- } +- } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ); +- } ++ /* This is an IBM Power issue */ ++ if ( flags.groups ) { ++ k = i; ++ if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_GROUPS, cid ) == PAPI_OK ) { ++ printf( "Groups: " ); ++ do { ++ printf( "%4d", ( ( k & PAPI_NTV_GROUP_AND_MASK ) >> ++ PAPI_NTV_GROUP_SHIFT ) - 1 ); ++ } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_GROUPS, cid ) ==PAPI_OK ); ++ printf( "\n" ); ++ } ++ } ++ ++ /* Print umasks */ ++ /* components that don't have them can just ignore */ ++ ++ if ( flags.umask ) { ++ k = i; ++ if ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ) { ++ do { ++ retval = PAPI_get_event_info( k, &info ); ++ if ( retval == PAPI_OK ) { ++ if ( parse_unit_masks( &info ) ) ++ print_event( &info, 2 ); ++ } ++ } while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK ); ++ } + +- } +- printf( "--------------------------------------------------------------------------------\n" ); ++ } ++ printf( "--------------------------------------------------------------------------------\n" ); + + } while (PAPI_enum_cmp_event( &i, enum_modifier, cid ) == PAPI_OK ); + } diff --git a/papi.spec b/papi.spec index bf12601..da1c741 100644 --- a/papi.spec +++ b/papi.spec @@ -2,12 +2,14 @@ Summary: Performance Application Programming Interface Name: papi Version: 5.1.1 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD Group: Development/System URL: http://icl.cs.utk.edu/papi/ Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz Patch200: papi-testsuite1.patch +Patch210: papi-native-option.patch +Patch211: papi-man.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: ncurses-devel BuildRequires: gcc-gfortran @@ -58,6 +60,8 @@ the PAPI user-space libraries and interfaces. %setup -q %patch200 -p1 +%patch210 -p1 +%patch211 -p1 %build %if %{without bundled_libpfm} @@ -86,6 +90,13 @@ popd #DBG workaround to make sure libpfm just uses the normal CFLAGS DBG="" make %{?_smp_mflags} +#generate updated versions of the documentation +#DBG workaround to make sure libpfm just uses the normal CFLAGS +pushd ../doc +DBG="" make %{?_smp_mflags} +DBG="" make %{?_smp_mflags} install +popd + %install rm -rf $RPM_BUILD_ROOT cd src @@ -128,6 +139,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.a %changelog +* Fri Jul 5 2013 William Cohen - 5.1.1-3 +- Add man page corrections/updates. + * Fri Jun 28 2013 William Cohen - 5.1.1-2 - Add testsuite subpackage.