PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
timer_overflow.c File Reference
Include dependency graph for timer_overflow.c:

Go to the source code of this file.

Macros

#define TIMER_THRESHOLD   100
 

Functions

int main (int argc, char **argv)
 

Variables

int TESTS_QUIET
 

Macro Definition 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.

18 {
19  int sleep_time = TIMER_THRESHOLD;
20  int retval, i;
21  long long timer;
22 
23  if ( argc > 1 ) {
24  if ( !strcmp( argv[1], "TESTS_QUIET" ) )
25  tests_quiet( argc, argv );
26  else {
27  sleep_time = atoi( argv[1] );
28  if ( sleep_time <= 0 )
29  sleep_time = TIMER_THRESHOLD;
30  }
31  }
32 
33  if ( TESTS_QUIET ) {
34  /* Skip the test in TESTS_QUIET so that the main script doesn't
35  * run this as it takes a long time to check for overflow
36  */
37  printf( "%-40s SKIPPED\nLine # %d\n", __FILE__, __LINE__ );
38  printf( "timer_overflow takes a long time to run, run separately.\n" );
39  exit( 0 );
40  }
41 
42  printf( "This test will take about: %f minutes.\n",
43  ( float ) ( 20 * ( sleep_time / 60.0 ) ) );
44  if ( ( retval =
46  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
47 
48  timer = PAPI_get_real_usec( );
49  for ( i = 0; i <= 20; i++ ) {
50  if ( timer < 0 )
51  break;
52  sleep( ( unsigned int ) sleep_time );
53  timer = PAPI_get_real_usec( );
54  }
55  if ( timer < 0 )
56  test_fail( __FILE__, __LINE__, "PAPI_get_real_usec: overflow", 1 );
57  else
58  test_pass( __FILE__, NULL, 0 );
59  exit( 1 );
60 }
#define TIMER_THRESHOLD
int atoi()
sleep(1)
tests_quiet(argc, argv)
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:497
int i
Definition: fileop.c:140
long long PAPI_get_real_usec(void)
Definition: papi.c:6190
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:223
void exit()

Here is the call graph for this function:

Variable Documentation

int TESTS_QUIET

Definition at line 11 of file test_utils.c.