1PAPI_perror(3)                       PAPI                       PAPI_perror(3)
2
3
4

NAME

6       PAPI_perror   - convert PAPI error codes to strings, and print error message to stderr.
7       PAPI_strerror - convert PAPI error codes to strings, and return the error string to user.
8
9

SYNOPSIS

11       C Interface
12       #include <papi.h>
13       int PAPI_perror(int code, char *destination, int length);
14       char *PAPI_strerror(int code);
15       Fortran Interface
16       #include fpapi.h
17       PAPIF_perror(C_INT code, C_STRING destination, C_INT check)
18
19

DESCRIPTION

21       PAPI_perror()  fills the string destination with the error message cor‐
22       responding to the error code code.  The function copies length worth of
23       the  error  description  string corresponding to code into destination.
24       The resulting string is always null terminated. If length  is  0,  then
25       the string is printed on stderr.
26
27       PAPI_strerror() returns a pointer to the error message corresponding to
28       the error code code.  If the call fails the function returns  the  NULL
29       pointer. This function is not implemented in Fortran.
30
31

ARGUMENTS

33       code -- the error code to interpret
34
35       *destination -- "the error message in quotes"
36
37       length -- either 0 or strlen(destination)
38
39

RETURN VALUES

41       On  success PAPI_perror() returns PAPI_OK.  and PAPI_strerror() returns
42       a non-NULL pointer.
43
44

ERRORS

46       PAPI_EINVAL
47              One or more of the arguments to PAPI_perror() is invalid.
48
49       NULL   The input error code to PAPI_strerror() is invalid.
50
51

EXAMPLE

53       int EventSet = PAPI_NULL;
54       int native = 0x0;
55       char error_str[PAPI_MAX_STR_LEN];
56
57       if ((retval = PAPI_create_eventset(&EventSet)) != PAPI_OK)
58         {
59            fprintf(stderr, "PAPI error %d: %s\n",retval,PAPI_strerror(retval));
60            exit(1);
61         }
62
63       /* Add Total Instructions Executed to our EventSet */
64
65       if ((retval = PAPI_add_event(EventSet, PAPI_TOT_INS)) != PAPI_OK)
66         {
67            PAPI_perror(retval,error_str,PAPI_MAX_STR_LEN);
68            fprintf(stderr,"PAPI_error %d: %s\n",retval,error_str);
69            exit(1);
70         }
71
72
73       /* Start counting */
74
75       if ((retval = PAPI_start(EventSet)) != PAPI_OK)
76         handle_error(retval);
77
78

BUGS

80       These functions have no known bugs.
81
82

SEE ALSO

84       PAPI_set_debug(3), PAPI_set_opt(3), PAPI_get_opt(3), PAPI_shutdown(3),
85
86
87
88PAPI Programmer's Reference     September, 2004                 PAPI_perror(3)
Impressum