overflow_one_and_read.c File Reference

Include dependency graph for overflow_one_and_read.c:

Go to the source code of this file.

Data Structures

struct  ocount_t

Defines

#define OVER_FMT   "handler(%d) Overflow at %p! vector=%#llx\n"
#define OUT_FMT   "%-12s : %16lld%16lld\n"

Functions

void handler (int EventSet, void *address, long long overflow_vector, void *context)
int main (int argc, char **argv)

Variables

ocount_t overflow_counts [3] = { {0, 0}, {0, 0}, {0, 0} }
int total_unknown = 0
long long dummyvalues [2]

Define Documentation

#define OUT_FMT   "%-12s : %16lld%16lld\n"

Definition at line 16 of file overflow_one_and_read.c.

#define OVER_FMT   "handler(%d) Overflow at %p! vector=%#llx\n"

Definition at line 15 of file overflow_one_and_read.c.


Function Documentation

void handler ( int  EventSet,
void *  address,
long long  overflow_vector,
void *  context 
)

Definition at line 32 of file overflow_one_and_read.c.

00033 {
00034     int retval;
00035 
00036     ( void ) context;
00037 
00038     if ( !TESTS_QUIET ) {
00039         fprintf( stderr, OVER_FMT, EventSet, address, overflow_vector );
00040     }
00041 
00042     if ( ( retval = PAPI_read( EventSet, dummyvalues ) ) != PAPI_OK )
00043         test_fail( __FILE__, __LINE__, "PAPI_read", retval );
00044 
00045     if ( !TESTS_QUIET ) {
00046         fprintf( stderr, TWO12, dummyvalues[0], dummyvalues[1],
00047                  "(Reading  counters)\n" );
00048     }
00049     if ( dummyvalues[1] == 0 )
00050         test_fail( __FILE__, __LINE__, "Total Cycles == 0", 1 );
00051 }

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 54 of file overflow_one_and_read.c.

00055 {
00056     int EventSet;
00057     long long **values = NULL;
00058     int retval;
00059     int PAPI_event;
00060     char event_name[PAPI_MAX_STR_LEN];
00061     int num_events1, mask1;
00062 
00063     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00064 
00065     retval = PAPI_library_init( PAPI_VER_CURRENT );
00066     if ( retval != PAPI_VER_CURRENT )
00067         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00068 
00069     /* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
00070        PAPI_TOT_INS, depends on the availability of the event on the
00071        platform */
00072 /* NOTE: Only adding one overflow on PAPI_event -- no overflow for PAPI_TOT_CYC*/
00073     EventSet =
00074         add_two_nonderived_events( &num_events1, &PAPI_event, &mask1 );
00075 
00076     values = allocate_test_space( 2, num_events1 );
00077 
00078     if ( ( retval =
00079            PAPI_event_code_to_name( PAPI_event, event_name ) ) != PAPI_OK )
00080         test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
00081 
00082     retval = PAPI_start( EventSet );
00083     if ( retval != PAPI_OK )
00084         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00085 
00086     do_flops( NUM_FLOPS );
00087 
00088     retval = PAPI_stop( EventSet, values[0] );
00089     if ( retval != PAPI_OK )
00090         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00091 
00092     retval = PAPI_overflow( EventSet, PAPI_event, THRESHOLD, 0, handler );
00093     if ( retval != PAPI_OK )
00094         test_fail( __FILE__, __LINE__, "PAPI_overflow", retval );
00095 
00096     retval = PAPI_start( EventSet );
00097     if ( retval != PAPI_OK )
00098         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00099 
00100     do_flops( NUM_FLOPS );
00101 
00102     retval = PAPI_stop( EventSet, values[1] );
00103     if ( retval != PAPI_OK )
00104         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00105 
00106     remove_test_events( &EventSet, mask1 );
00107 
00108 
00109     if ( !TESTS_QUIET ) {
00110         printf
00111             ( "Test case: Overflow dispatch of 1st event in set with 2 events.\n" );
00112         printf
00113             ( "---------------------------------------------------------------\n" );
00114         printf( "Threshold for overflow is: %d\n", THRESHOLD );
00115         printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
00116         printf( "-----------------------------------------------\n" );
00117 
00118         printf( "Test type    : %16d%16d\n", 1, 2 );
00119         printf( OUT_FMT, event_name, ( values[0] )[0], ( values[1] )[0] );
00120         printf( OUT_FMT, "PAPI_TOT_CYC", ( values[0] )[1], ( values[1] )[1] );
00121     }
00122 
00123     test_pass( __FILE__, NULL, 0 );
00124     exit( 1 );
00125 }

Here is the call graph for this function:


Variable Documentation

long long dummyvalues[2]

Definition at line 29 of file overflow_one_and_read.c.

ocount_t overflow_counts[3] = { {0, 0}, {0, 0}, {0, 0} }

Definition at line 26 of file overflow_one_and_read.c.

int total_unknown = 0

Definition at line 27 of file overflow_one_and_read.c.


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1