37{
38 int j;
41 int ret;
42 long nthr;
44
46
49 test_fail( __FILE__, __LINE__,
"PAPI_library_init", ret );
50
51 if ( ( ret =
53 long ( * )( void ) ) ( pthread_self ) ) ) !=
55 test_fail( __FILE__, __LINE__,
"PAPI_thread_init", ret );
56
57 pthread_attr_init( &attr );
58#ifdef PTHREAD_CREATE_UNDETACHED
59 pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );
60#endif
61#ifdef PTHREAD_SCOPE_SYSTEM
62 ret=pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
63 if ( ret != 0 )
64 test_skip( __FILE__, __LINE__,
"pthread_attr_setscope", ret );
65
66#endif
67
69 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 0 );
70
72
74 printf( "Creating %ld threads for %d iterations each of:\n", nthr,
76 printf( "\tregister\n" );
77 printf( "\tcreate_eventset\n" );
78 printf( "\tdestroy_eventset\n" );
79 printf( "\tunregister\n" );
80 }
81
83 if ( th == NULL )
85
86 for ( j = 0; j < nthr; j++ ) {
87 ret = pthread_create( &th[j], &attr, &
Thread, NULL );
88 if ( ret ) {
89 free(th);
91 }
92 }
93
94 for ( j = 0; j < nthr; j++ ) {
95 pthread_join( th[j], NULL );
96 }
97
98 free(th);
100
101 return 0;
102
103}
get information about the system hardware
initialize the PAPI library.
Initialize thread support in the PAPI library.
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)