19 test_fail( __FILE__, __LINE__,
"PAPI_thread_init", ret );
23 test_fail( __FILE__, __LINE__,
"PAPI_create_eventset", ret );
26 test_fail( __FILE__, __LINE__,
"PAPI_destroy_eventset", ret );
29 test_fail( __FILE__, __LINE__,
"PAPI_unregister_thread", ret );
35main(
int argc,
char *argv[] )
47 test_fail( __FILE__, __LINE__,
"PAPI_library_init", ret );
51 long ( * )(
void ) ) ( pthread_self ) ) ) !=
53 test_fail( __FILE__, __LINE__,
"PAPI_thread_init", ret );
55 pthread_attr_init( &attr );
56#ifdef PTHREAD_CREATE_UNDETACHED
57 pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );
59#ifdef PTHREAD_SCOPE_SYSTEM
60 ret = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
62 test_skip( __FILE__, __LINE__,
"pthread_attr_setscope", ret );
69 printf(
"Creating %d threads for %d iterations each of:\n",
71 printf(
"\tregister\n" );
72 printf(
"\tcreate_eventset\n" );
73 printf(
"\tdestroy_eventset\n" );
74 printf(
"\tunregister\n" );
80 for ( j = 0; j < nthr; j++ ) {
81 ret = pthread_create( &th[j], &attr, &
Thread, NULL );
83 printf(
"Failed to create thread: %d\n", j );
88 printf(
"Continuing test with %d threads.\n", j - 1 );
97 for ( j = 0; j < nthr; j++ ) {
98 pthread_join( th[j], NULL );
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
initialize the PAPI library.
Notify PAPI that a thread has 'appeared'.
Initialize thread support in the PAPI library.
Notify PAPI that a thread has 'disappeared'.
Return codes and api definitions.
unsigned long int pthread_t
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
void * Thread(void *data)