papi/papi-man.patch
2013-07-05 17:15:30 -04:00

303 lines
10 KiB
Diff

commit f10342a88c4b591b80444b5e2ff8ec063ef58fa4
Author: William Cohen <wcohen@redhat.com>
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 <wcohen@redhat.com>
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 <wcohen@redhat.com>
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 <wcohen@redhat.com>
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 @@
* <li>-e EVENTNAME display detailed information about named native event
* <li>-i EVENTSTR include only event names that contain EVENTSTR
* <li>-x EVENTSTR exclude any event names that contain EVENTSTR
- * <li>--nomasks suppress display of Unit Mask information
+ * <li>--noumasks suppress display of Unit Mask information
* </ul>
*
* 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 <wcohen@redhat.com>
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 <wcohen@redhat.com>
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 <wcohen@redhat.com>
Date: Mon Jul 1 16:12:22 2013 -0400
Improve option matching in papi_component and add "--help" option
Signed-off-by: William Cohen <wcohen@redhat.com>
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 <wcohen@redhat.com>
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 <wcohen@redhat.com>
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.
+ * <ul>
+ * <li>-u Display output values as unsigned integers
+ * <li>-x Display output values as hexadecimal
+ * <li>-h Display help information about this utility.
+ * </ul>
*
* @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 <wcohen@redhat.com>
Date: Mon Jul 1 16:12:20 2013 -0400
Add information for papi_version to be complete
Signed-off-by: William Cohen <wcohen@redhat.com>
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 <ptools-perfapi@ptools.org>.
+ */
/* This utility displays the current PAPI version number */
#include <stdlib.h>