33 printf(
"Thread %#x started, specific data is at %p\n",
34 (
int ) pthread_self( ), arg );
48 test_fail( __FILE__, __LINE__,
"set vs get specific", 0 );
52 if ( *( (
int * ) arg ) == 500000 ) {
57 data.
id = (
unsigned long * ) malloc( (
size_t ) data.
num *
58 sizeof (
unsigned long ) );
59 data.
data = (
void ** ) malloc( (
size_t ) data.
num *
sizeof (
void * ) );
64 test_fail( __FILE__, __LINE__,
"PAPI_get_thr_specific",
68 if ( data.num != 5 ) {
69 test_fail( __FILE__, __LINE__,
"data.num != 5", 0 );
73 printf(
"Entry %d, Thread %#lx, Data Pointer %p, Value %d\n",
74 i, data.id[
i], data.data[
i], *(
int * ) data.data[
i] );
89 main(
int argc,
char **argv )
92 int flops1, flops2, flops3, flops4, flops5;
100 if (!
quiet) printf(
"Testing threads\n");
112 "PAPI_thread_init",
retval );
116 "PAPI_thread_init",
retval );
120 pthread_attr_init( &attr );
122 #ifdef PTHREAD_CREATE_UNDETACHED 123 pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );
126 #ifdef PTHREAD_SCOPE_SYSTEM 127 retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
134 rc = pthread_create( &e_th, &attr,
Thread, (
void * ) &flops1 );
141 rc = pthread_create( &f_th, &attr,
Thread, (
void * ) &flops2 );
148 rc = pthread_create( &g_th, &attr,
Thread, (
void * ) &flops3 );
155 rc = pthread_create( &h_th, &attr,
Thread, (
void * ) &flops4 );
161 pthread_attr_destroy( &attr );
166 pthread_join( h_th, NULL );
167 pthread_join( g_th, NULL );
168 pthread_join( f_th, NULL );
169 pthread_join( e_th, NULL );
173 pthread_exit( NULL );
void test_pass(const char *filename)
unsigned long int pthread_t
int PAPI_register_thread(void)
static volatile int processing
Return codes and api definitions.
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_get_thr_specific(int tag, void **ptr)
#define PAPI_TLS_ALL_THREADS
int PAPI_thread_init(unsigned long int(*id_fn)(void))
int PAPI_library_init(int version)
int main(int argc, char **argv)
int PAPI_unregister_thread(void)
int PAPI_set_thr_specific(int tag, void *ptr)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)