PAPI  5.0.1.0
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=0x%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=0x%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.

{
    int retval;

    ( void ) context;

    if ( !TESTS_QUIET ) {
        fprintf( stderr, OVER_FMT, EventSet, address, overflow_vector );
    }

    if ( ( retval = PAPI_read( EventSet, dummyvalues ) ) != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_read", retval );

    if ( !TESTS_QUIET ) {
        fprintf( stderr, TWO12, dummyvalues[0], dummyvalues[1],
                 "(Reading  counters)\n" );
    }
    if ( dummyvalues[1] == 0 )
        test_fail( __FILE__, __LINE__, "Total Cycles == 0", 1 );
}

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.

{
    int EventSet;
    long long **values = NULL;
    int retval;
    int PAPI_event;
    char event_name[PAPI_MAX_STR_LEN];
    int num_events1, mask1;

    tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */

    retval = PAPI_library_init( PAPI_VER_CURRENT );
    if ( retval != PAPI_VER_CURRENT )
        test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );

    /* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
       PAPI_TOT_INS, depends on the availability of the event on the
       platform */
/* NOTE: Only adding one overflow on PAPI_event -- no overflow for PAPI_TOT_CYC*/
    EventSet =
        add_two_nonderived_events( &num_events1, &PAPI_event, &mask1 );

    values = allocate_test_space( 2, num_events1 );

    if ( ( retval =
           PAPI_event_code_to_name( PAPI_event, event_name ) ) != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );

    retval = PAPI_start( EventSet );
    if ( retval != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_start", retval );

    do_flops( NUM_FLOPS );

    retval = PAPI_stop( EventSet, values[0] );
    if ( retval != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_stop", retval );

    retval = PAPI_overflow( EventSet, PAPI_event, THRESHOLD, 0, handler );
    if ( retval != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_overflow", retval );

    retval = PAPI_start( EventSet );
    if ( retval != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_start", retval );

    do_flops( NUM_FLOPS );

    retval = PAPI_stop( EventSet, values[1] );
    if ( retval != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_stop", retval );

    remove_test_events( &EventSet, mask1 );


    if ( !TESTS_QUIET ) {
        printf
            ( "Test case: Overflow dispatch of 1st event in set with 2 events.\n" );
        printf
            ( "---------------------------------------------------------------\n" );
        printf( "Threshold for overflow is: %d\n", THRESHOLD );
        printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
        printf( "-----------------------------------------------\n" );

        printf( "Test type    : %16d%16d\n", 1, 2 );
        printf( OUT_FMT, event_name, ( values[0] )[0], ( values[1] )[0] );
        printf( OUT_FMT, "PAPI_TOT_CYC", ( values[0] )[1], ( values[1] )[1] );
    }

    test_pass( __FILE__, NULL, 0 );
    exit( 1 );
}

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.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines