NAME

PAPI_perror, PAPI_strerror - convert PAPI error codes to strings

CONTENTS

Synopsis
Description
Arguments
Return Values
Errors
Example
Authors
Bugs
See Also

SYNOPSIS

C Interface

#include <papi.h> 

int PAPI_perror(int code, char *destination, int length); 

char *PAPI_strerror(int code); 

Fortran Interface

#include fpapi.h 

PAPIF_perror(C_INT code, C_STRING destination, C_INT check) 

DESCRIPTION

PAPI_perror() fills the string destination with the error message corresponding to the error code code. The function copies length worth of the error description string corresponding to code into destination. The resulting string is always null terminated. If length is 0, then the string is printed on stderr.

PAPI_strerror() returns a pointer to the error message corresponding to the error code code. If the call fails the function returns the NULL pointer. This function is not implemented in Fortran.

ARGUMENTS

code -- the error code to interpret

*destination -- "the error message in quotes"

length -- either 0 or strlen(destination)

RETURN VALUES

On success PAPI_perror() returns PAPI_OK. and PAPI_strerror() returns a non-NULL pointer.

ERRORS

PAPI_EINVAL
  One or more of the arguments to PAPI_perror() is invalid.

EXAMPLE


int EventSet = PAPI_NULL;
int native = 0x0;
char error_str[PAPI_MAX_STR_LEN];
        
if ((retval = PAPI_create_eventset(&EventSet)) != PAPI_OK)
  {
     fprintf(stderr, "PAPI error %d: %s\n",retval,PAPI_strerror(retval));
     exit(1);
  }     

/* Add Total Instructions Executed to our EventSet */

if ((retval = PAPI_add_event(EventSet, PAPI_TOT_INS)) != PAPI_OK) { PAPI_perror(retval,error_str,PAPI_MAX_STR_LEN); fprintf(stderr,"PAPI_error %d: %s\n",retval,error_str); exit(1); }

/* Start counting */

if ((retval = PAPI_start(EventSet)) != PAPI_OK) handle_error(retval);

AUTHORS

The PAPI Team. See them at the PAPI Web Site: http://icl.cs.utk.edu/projects/papi

BUGS

These functions have no known bugs.

SEE ALSO

PAPI_set_debug (3), PAPI_set_opt (3), PAPI_get_opt (3), PAPI_shutdown (3),


PAPI Programmer’s Reference PAPI_perror (3) November, 2003

  Innovative Computing Laboratory
2001 R&D Winner  
Contact PAPI: papi@cs.utk.edu Computer Science Department
  University of Tennessee