| 
 
     NAME
 
PAPI_overflow - set up an event set
to begin registering overflows;
  
CONTENTS
Synopsis 
Description 
Arguments 
Return Values 
Errors 
Examples 
Authors 
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); 
 
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. More than one event in an event set can be used as
overflow triggers, in such case, the user must call this function several
times.
To turn off overflow, set the threshold to 0. If the user get negative number or small number for the result of the overflow events, dont be surprised.  To reduce the overhead of PAPI_read, we dont adjust the number. If the platform use hardware overflow, then based on the threshold and how many times it overflowed, you can get an approximate number.
  
     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
 
 
  
     RETURN VALUES
On success, PAPI_overflow returns
PAPI_OK.  
 On error, a non-zero error code is returned.
  
     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, void *address, long_long overflow_vector, void *context)
{
  fprintf(stderr,"Overflow at %p! bit=0x%llx \n",
          address,overflow_vector);
}
  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);
 
 
  
     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_preset (3), 
PAPI_set_opt (3), 
PAPI_start (3), 
PAPI_remove_event (3), 
PAPI_remove_events (3), 
PAPI_query (3), 
PAPI_cleanup_eventset (3), 
PAPI_destroy_eventset (3)
 
 
 | PAPI Programmers Reference |  PAPI_overflow (3) |  November, 2003 |    
 
 | 
 
 
 |