clockres_pthreads.c File Reference

Include dependency graph for clockres_pthreads.c:

Go to the source code of this file.

Functions

void * pthread_main (void *arg)
int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file clockres_pthreads.c.

00025 {
00026     pthread_t t1, t2, t3, t4;
00027     pthread_attr_t attr;
00028     int retval;
00029 
00030     /* Set TESTS_QUIET variable */
00031     tests_quiet( argc, argv );  
00032 
00033     if (( retval = PAPI_library_init( PAPI_VER_CURRENT)) != PAPI_VER_CURRENT) {
00034        test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00035     }
00036     
00037     retval = PAPI_thread_init( ( unsigned long ( * )(void) ) (pthread_self) );
00038     if ( retval != PAPI_OK ) {
00039        if ( retval == PAPI_ECMP ) {
00040       test_skip( __FILE__, __LINE__, "PAPI_thread_init", retval );
00041        }
00042        else {
00043       test_fail( __FILE__, __LINE__, "PAPI_thread_init", retval );
00044        }
00045     }
00046 
00047     if ( !TESTS_QUIET ) {
00048        printf( "Test case: Clock latency and resolution.\n" );
00049        printf( "Note: Virtual timers are proportional to # CPUs.\n" );
00050        printf( "------------------------------------------------\n" );
00051     }
00052 
00053     pthread_attr_init( &attr );
00054 
00055 #ifdef PTHREAD_CREATE_UNDETACHED
00056     pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );
00057 #endif
00058 
00059 #ifdef PTHREAD_SCOPE_SYSTEM
00060     retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
00061     if ( retval != 0 ) {
00062        test_skip( __FILE__, __LINE__, "pthread_attr_setscope", retval );
00063     }
00064 #endif
00065 
00066     if (pthread_create( &t1, &attr, pthread_main, NULL )) {
00067        test_fail(__FILE__, __LINE__, "cannot create thread", retval);
00068     }
00069     
00070     if (pthread_create( &t2, &attr, pthread_main, NULL )) {
00071        test_fail(__FILE__, __LINE__, "cannot create thread", retval);
00072     }
00073     
00074     if (pthread_create( &t3, &attr, pthread_main, NULL )) {
00075        test_fail(__FILE__, __LINE__, "cannot create thread", retval);
00076     }
00077 
00078     if (pthread_create( &t4, &attr, pthread_main, NULL )) {
00079        test_fail(__FILE__, __LINE__, "cannot create thread", retval);
00080     }
00081 
00082     pthread_main( NULL );
00083 
00084     pthread_join( t1, NULL );
00085     pthread_join( t2, NULL );
00086     pthread_join( t3, NULL );
00087     pthread_join( t4, NULL );
00088 
00089     test_pass( __FILE__, NULL, 0 );
00090     exit( 0 );
00091 }

Here is the call graph for this function:

void* pthread_main ( void *  arg  ) 

Definition at line 6 of file clockres_pthreads.c.

00007 {
00008     ( void ) arg;
00009     int retval = PAPI_register_thread(  );
00010     if ( retval != PAPI_OK ) {
00011        test_fail( __FILE__, __LINE__, "PAPI_register_thread", retval );
00012     }
00013 
00014     clockcore(  );
00015 
00016     retval = PAPI_unregister_thread(  );
00017     if ( retval != PAPI_OK ) {
00018        test_fail( __FILE__, __LINE__, "PAPI_unregister_thread", retval );
00019     }
00020     return NULL;
00021 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1