7#define APPR_TOTAL_ITER 1000000
25lockloop(
int iters,
volatile long long *mycount )
28 for (
i = 0;
i < iters;
i++ ) {
30 *mycount = *mycount + 1;
45 printf(
"%f lock/unlocks per us\n",
53main(
int argc,
char **argv )
69 if (hwinfo == NULL ) {
70 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 2 );
77 "PAPI_thread_init",
retval );
81 "PAPI_thread_init",
retval );
96 printf(
"Creating %d threads, %lld lock/unlock\n",
100 for (
i = 0;
i < nthr;
i++ ) {
101 rc = pthread_create( &slaves[
i], NULL,
Slave, NULL );
105 "pthread_create",
retval );
109 for (
i = 0;
i < nthr;
i++ ) {
110 pthread_join( slaves[
i], NULL );
114 printf(
"Expected: %lld Received: %lld\n",
120 test_fail( __FILE__, __LINE__,
"Thread Locks", 1 );
get information about the system hardware
get real time counter value in microseconds
initialize the PAPI library.
Lock one of two mutex variables defined in papi.h.
Initialize thread support in the PAPI library.
Unlock one of the mutex variables defined in papi.h.
void lockloop(int iters, volatile long long *mycount)
volatile long long tmpcount
volatile long long thread_iter
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)