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",
91main(
int argc,
char **argv )
94 int flops1, flops2, flops3, flops4, flops5;
102 if (!
quiet) printf(
"Testing threads\n");
114 "PAPI_thread_init",
retval );
118 "PAPI_thread_init",
retval );
122 pthread_attr_init( &attr );
124#ifdef PTHREAD_CREATE_UNDETACHED
125 pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );
128#ifdef PTHREAD_SCOPE_SYSTEM
129 retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
136 rc = pthread_create( &e_th, &attr,
Thread, (
void * ) &flops1 );
143 rc = pthread_create( &f_th, &attr,
Thread, (
void * ) &flops2 );
150 rc = pthread_create( &g_th, &attr,
Thread, (
void * ) &flops3 );
157 rc = pthread_create( &h_th, &attr,
Thread, (
void * ) &flops4 );
163 pthread_attr_destroy( &attr );
168 pthread_join( h_th, NULL );
169 pthread_join( g_th, NULL );
170 pthread_join( f_th, NULL );
171 pthread_join( e_th, NULL );
175 pthread_exit( NULL );
Retrieve a pointer to a thread specific data structure.
initialize the PAPI library.
Notify PAPI that a thread has 'appeared'.
Store a pointer to a thread specific data structure.
Initialize thread support in the PAPI library.
Notify PAPI that a thread has 'disappeared'.
#define PAPI_TLS_ALL_THREADS
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)
static volatile int processing