57 printf(
"Thread %#x started\n", (
int ) pthread_self( ) );
100 printf(
"Thread %#x %-12s : \t%lld\n", (
int ) pthread_self( ),
102 printf(
"Thread %#x PAPI_TOT_CYC : \t%lld\n", (
int) pthread_self(),
104 printf(
"Thread %#x Real usec : \t%lld\n",
105 (
int ) pthread_self( ),
107 printf(
"Thread %#x Real cycles : \t%lld\n", (
int) pthread_self(),
123 int flops1, flops2, flops3, flops4;
139 if (!
quiet) printf(
"Can't find PAPI_TOT_INS\n");
140 test_skip(__FILE__,__LINE__,
"Event missing",1);
144 if (!
quiet) printf(
"Can't find PAPI_TOT_CYC\n");
145 test_skip(__FILE__,__LINE__,
"Event missing",1);
164 pthread_attr_init( &attr );
165#ifdef PTHREAD_CREATE_UNDETACHED
166 pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_UNDETACHED );
168#ifdef PTHREAD_SCOPE_SYSTEM
169 retval = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
175 rc = pthread_create( &e_th, &attr,
Thread, (
void * ) &flops1 );
181 rc = pthread_create( &f_th, &attr,
Thread, (
void * ) &flops2 );
188 rc = pthread_create( &g_th, &attr,
Thread, (
void * ) &flops3 );
195 rc = pthread_create( &h_th, &attr,
Thread, (
void * ) &flops4 );
201 pthread_attr_destroy( &attr );
204 pthread_join( h_th, NULL );
205 pthread_join( g_th, NULL );
206 pthread_join( f_th, NULL );
207 pthread_join( e_th, NULL );
213 printf(
"Master real usec : \t%lld\n",
elapsed_us );
214 printf(
"Master real cycles : \t%lld\n",
elapsed_cyc );
219 pthread_exit( NULL );
Convert a numeric hardware event code to a name.
get real time counter value in clock cycles Returns the total real time passed since some arbitrary s...
get real time counter value in microseconds
initialize the PAPI library.
Query if PAPI event exists.
Notify PAPI that a thread has 'appeared'.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Initialize thread support in the PAPI library.
Notify PAPI that a thread has 'disappeared'.
char event_name[2][PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
Return codes and api definitions.
unsigned long int pthread_t
int tests_quiet(int argc, char **argv)
void free_test_space(long long **values, int num_tests)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
long long ** allocate_test_space(int num_tests, int num_events)
void PAPI_NORETURN test_pass(const char *filename)
int add_two_events(int *num_events, int *papi_event, int *mask)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
int remove_test_events(int *EventSet, int mask)