165 if ( argc < 2 || sscanf( argv[1],
"%d", &
program_time ) < 1 )
167 if ( argc < 3 || sscanf( argv[2],
"%d", &
threshold ) < 1 )
169 if ( argc < 4 || sscanf( argv[3],
"%d", &
num_threads ) < 1 )
174 test_fail( __FILE__, __LINE__,
"td malloc failed", 1 );
178 printf(
"program_time = %d, threshold = %d, num_threads = %d\n\n",
183 test_fail( __FILE__, __LINE__,
"PAPI_library_init failed", 1 );
188 if (!
quiet) printf(
"Trouble finding event\n");
189 test_skip(__FILE__,__LINE__,
"Event not available",1);
192 if (
PAPI_thread_init( (
unsigned long ( * )(
void ) ) ( pthread_self ) ) !=
194 test_fail( __FILE__, __LINE__,
"PAPI_thread_init failed", 1 );
196 if ( pthread_key_create( &
key, NULL ) != 0 )
197 test_fail( __FILE__, __LINE__,
"pthread key create failed", 1 );
202 if ( pthread_create( &(td[n]), NULL,
my_thread, (
void * ) n ) != 0 )
203 test_fail( __FILE__, __LINE__,
"pthread create failed", 1 );
210 if ( pthread_join( td[n], NULL))
211 test_fail( __FILE__, __LINE__,
"pthread join failed", 1 );
216 if (!
quiet) printf(
"done\n" );
void test_pass(const char *filename)
unsigned long int pthread_t
static struct timeval start
static void * my_thread(void *v)
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_thread_init(unsigned long int(*id_fn)(void))
int PAPI_library_init(int version)
int PAPI_query_event(int EventCode)
int gettimeofday(void *ptr1, void *ptr2)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)