PAPI  5.0.1.0
timer_overflow.c File Reference
Include dependency graph for timer_overflow.c:

Go to the source code of this file.

Defines

#define TIMER_THRESHOLD   100

Functions

int main (int argc, char **argv)

Variables

int TESTS_QUIET

Define Documentation

#define TIMER_THRESHOLD   100

Definition at line 13 of file timer_overflow.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file timer_overflow.c.

{
    int sleep_time = TIMER_THRESHOLD;
    int retval, i;
    long long timer;

    if ( argc > 1 ) {
        if ( !strcmp( argv[1], "TESTS_QUIET" ) )
            tests_quiet( argc, argv );
        else {
            sleep_time = atoi( argv[1] );
            if ( sleep_time <= 0 )
                sleep_time = TIMER_THRESHOLD;
        }
    }

    if ( TESTS_QUIET ) {
        /* Skip the test in TESTS_QUIET so that the main script doesn't
         * run this as it takes a long time to check for overflow
         */
        printf( "%-40s SKIPPED\nLine # %d\n", __FILE__, __LINE__ );
        printf( "timer_overflow takes a long time to run, run separately.\n" );
        exit( 0 );
    }

    printf( "This test will take about: %f minutes.\n",
            ( float ) ( 20 * ( sleep_time / 60.0 ) ) );
    if ( ( retval =
           PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
        test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );

    timer = PAPI_get_real_usec(  );
    for ( i = 0; i <= 20; i++ ) {
        if ( timer < 0 )
            break;
        sleep( ( unsigned int ) sleep_time );
        timer = PAPI_get_real_usec(  );
    }
    if ( timer < 0 )
        test_fail( __FILE__, __LINE__, "PAPI_get_real_usec: overflow", 1 );
    else
        test_pass( __FILE__, NULL, 0 );
    exit( 1 );
}

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines