NAME

PAPI_overflow, PAPI_get_overflow_address - set up an event set to begin registering overflows; return the address at which an overflow occured

CONTENTS

Synopsis
Description
Arguments
Return Values
Errors
Examples
Author
Bugs
See Also

SYNOPSIS

C Interface

#include <papi.h> 

int PAPI_overflow (int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler); 

void *PAPI_get_overflow_address (void *context); 

Fortran Interface

Not implemented 

DESCRIPTION

PAPI_overflow() marks a specific EventCode in an EventSet to generate an overflow signal after every threshold events are counted. Only one event in an event set can be used as an overflow trigger. Subsequent calls to PAPI_overflow() replace earlier calls. To turn off overflow, set the handler to NULL.

PAPI_get_overflow_address() returns the instruction pointer where overflow occured. This routine is often used as part of the overflow handler routine.

ARGUMENTS

EventSet -- a reference to the event set to use

EventCode -- the counter to be used for overflow detection

threshold -- the overflow threshold value to use

flags -- bit map that controls the overflow mode of operation. This is currently not used and should be set to 0.

handler -- the handler function to call upon overflow

context -- a platform dependent structure containing information about the overflow event. This structure is typically returned automatically by the signal handler.

RETURN VALUES

On success, PAPI_overflow returns PAPI_OK.
On error, a non-zero error code is returned.
PAPI_get_overflow_address returns the instruction pointer where the overflow occured. PAPI_get_overflow_address always returns the value at the offset in the context structure where the instruction pointer should be. No validity testing of this structure is done. If an invalid context pointer is passed to this function, the results will be undefined.

ERRORS

PAPI_EINVAL
  One or more of the arguments is invalid.
PAPI_ENOMEM
  Insufficient memory to complete the operation.
PAPI_ENOEVST
  The EventSet specified does not exist.
PAPI_EISRUN
  The EventSet is currently counting events.
PAPI_ECNFLCT
  The underlying counter hardware can not count this event and other events in the EventSet simultaneously.
PAPI_ENOEVNT
  The PAPI preset is not available on the underlying hardware.

EXAMPLES


void handler(int EventSet, int EventCode, int EventIndex, long_long *values, int *threshold, void *context)
{
  fprintf(stderr,"Value %lld at %p\n",
          values[EventIndex],PAPI_get_overflow_address(context));
#endif
  total++;
}

int EventSet = PAPI_NULL;          if (PAPI_create_eventset(&EventSet) != PAPI_OK) handle_error(1);

/* Add Total Instructions Executed to our EventSet */

if (PAPI_add_event(&EventSet, PAPI_TOT_INS) != PAPI_OK) handle_error(1);

/* Call handler every 100000 instructions */

retval = PAPI_overflow(EventSet, PAPI_TOT_INS, THRESHOLD, 0, handler); if (retval != PAPI_OK) exit(1);

/* Start counting */

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

AUTHOR

Philip J. Mucci <mucci@cs.utk.edu>

BUGS

These functions have no known bugs.

SEE ALSO

PAPI_preset (3), PAPI_set_opt (3), PAPI_start (3), PAPI_rem_event (3), PAPI_rem_events (3), PAPI_query (3), PAPI_cleanup_eventset (3), PAPI_destroy_eventset (3),
The PAPI Web Site: http://icl.cs.utk.edu/projects/papi


PAPI Function Reference PAPI_overflow (3) December, 2001

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