File: papi_error_codes.c

package info (click to toggle)
papi 5.7.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,856 kB
  • sloc: ansic: 93,265; fortran: 3,338; xml: 2,460; makefile: 815; sh: 290
file content (72 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * This utility loops through all the PAPI error codes and displays them in
 *	table format
*/

/** file error_codes.c
  * @brief papi_error_codes utility.
  *	@page papi_error_codes
  *	@section  NAME
  *		papi_error_codes - lists all currently defined PAPI error codes. 
  *
  *	@section Synopsis
  *		papi_error_codes
  *
  *	@section Description
  *		papi_error_codes is a PAPI utility program that displays all defined
  *		error codes from papi.h and their error strings from papi_data.h.
  *		If an error string is not defined, a warning is generated. This can
  *		help trap newly defined error codes for which error strings are not
  *		yet defined.
  *
  *	@section Options
  *		This utility has no command line options.
  *
  *	@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@icl.utk.edu>.
 */

#include <stdio.h>

#include "papi.h"

int
main( int argc, char **argv )
{
	int i=0;
	int retval;

	(void)argc;
	(void)argv;

 	retval = PAPI_library_init( PAPI_VER_CURRENT );
	if (retval != PAPI_VER_CURRENT ) {
		fprintf(stderr,"Error with PAPI_library_init!\n");
		return retval;
	}

	printf( "\n----------------------------------\n" );
	printf( "For PAPI Version: %d.%d.%d.%d\n",
			PAPI_VERSION_MAJOR( PAPI_VERSION ),
			PAPI_VERSION_MINOR( PAPI_VERSION ),
			PAPI_VERSION_REVISION( PAPI_VERSION ),
			PAPI_VERSION_INCREMENT( PAPI_VERSION ) );
	printf( "----------------------------------\n" );
	while ( 1 ) {
		char *errstr;
		errstr = PAPI_strerror( -i );

		if ( NULL == errstr ) {
		    break;
		}

		printf( "Error code %4d: %s\n", -i, errstr );
		i++;
	}
	printf( "There are %d error codes defined\n", i );
	printf( "----------------------------------\n\n" );

	return 0;
}