|
Packit |
577717 |
/*
|
|
Packit |
577717 |
* This utility loops through all the PAPI error codes and displays them in
|
|
Packit |
577717 |
* table format
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** file error_codes.c
|
|
Packit |
577717 |
* @brief papi_error_codes utility.
|
|
Packit |
577717 |
* @page papi_error_codes
|
|
Packit |
577717 |
* @section NAME
|
|
Packit |
577717 |
* papi_error_codes - lists all currently defined PAPI error codes.
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @section Synopsis
|
|
Packit |
577717 |
* papi_error_codes
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @section Description
|
|
Packit |
577717 |
* papi_error_codes is a PAPI utility program that displays all defined
|
|
Packit |
577717 |
* error codes from papi.h and their error strings from papi_data.h.
|
|
Packit |
577717 |
* If an error string is not defined, a warning is generated. This can
|
|
Packit |
577717 |
* help trap newly defined error codes for which error strings are not
|
|
Packit |
577717 |
* yet defined.
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @section Options
|
|
Packit |
577717 |
* This utility has no command line options.
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @section Bugs
|
|
Packit |
577717 |
* There are no known bugs in this utility.
|
|
Packit |
577717 |
* If you find a bug, it should be reported to the
|
|
Packit |
577717 |
* PAPI Mailing List at <ptools-perfapi@icl.utk.edu>.
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include <stdio.h>
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "papi.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int
|
|
Packit |
577717 |
main( int argc, char **argv )
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int i=0;
|
|
Packit |
577717 |
int retval;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
(void)argc;
|
|
Packit |
577717 |
(void)argv;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
retval = PAPI_library_init( PAPI_VER_CURRENT );
|
|
Packit |
577717 |
if (retval != PAPI_VER_CURRENT ) {
|
|
Packit |
577717 |
fprintf(stderr,"Error with PAPI_library_init!\n");
|
|
Packit |
577717 |
return retval;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
printf( "\n----------------------------------\n" );
|
|
Packit |
577717 |
printf( "For PAPI Version: %d.%d.%d.%d\n",
|
|
Packit |
577717 |
PAPI_VERSION_MAJOR( PAPI_VERSION ),
|
|
Packit |
577717 |
PAPI_VERSION_MINOR( PAPI_VERSION ),
|
|
Packit |
577717 |
PAPI_VERSION_REVISION( PAPI_VERSION ),
|
|
Packit |
577717 |
PAPI_VERSION_INCREMENT( PAPI_VERSION ) );
|
|
Packit |
577717 |
printf( "----------------------------------\n" );
|
|
Packit |
577717 |
while ( 1 ) {
|
|
Packit |
577717 |
char *errstr;
|
|
Packit |
577717 |
errstr = PAPI_strerror( -i );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if ( NULL == errstr ) {
|
|
Packit |
577717 |
break;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
printf( "Error code %4d: %s\n", -i, errstr );
|
|
Packit |
577717 |
i++;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
printf( "There are %d error codes defined\n", i );
|
|
Packit |
577717 |
printf( "----------------------------------\n\n" );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
return 0;
|
|
Packit |
577717 |
}
|