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.

00018 {
00019     int sleep_time = TIMER_THRESHOLD;
00020     int retval, i;
00021     long long timer;
00022 
00023     if ( argc > 1 ) {
00024         if ( !strcmp( argv[1], "TESTS_QUIET" ) )
00025             tests_quiet( argc, argv );
00026         else {
00027             sleep_time = atoi( argv[1] );
00028             if ( sleep_time <= 0 )
00029                 sleep_time = TIMER_THRESHOLD;
00030         }
00031     }
00032 
00033     if ( TESTS_QUIET ) {
00034         /* Skip the test in TESTS_QUIET so that the main script doesn't
00035          * run this as it takes a long time to check for overflow
00036          */
00037         printf( "%-40s SKIPPED\nLine # %d\n", __FILE__, __LINE__ );
00038         printf( "timer_overflow takes a long time to run, run separately.\n" );
00039         exit( 0 );
00040     }
00041 
00042     printf( "This test will take about: %f minutes.\n",
00043             ( float ) ( 20 * ( sleep_time / 60.0 ) ) );
00044     if ( ( retval =
00045            PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
00046         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00047 
00048     timer = PAPI_get_real_usec(  );
00049     for ( i = 0; i <= 20; i++ ) {
00050         if ( timer < 0 )
00051             break;
00052         sleep( ( unsigned int ) sleep_time );
00053         timer = PAPI_get_real_usec(  );
00054     }
00055     if ( timer < 0 )
00056         test_fail( __FILE__, __LINE__, "PAPI_get_real_usec: overflow", 1 );
00057     else
00058         test_pass( __FILE__, NULL, 0 );
00059     exit( 1 );
00060 }

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1