54#define NUM_FLOPS 20000000
97 printf(
"-------------------------------------------------------------------------\n" );
98 if (sleep_test) printf(
"Sleeping for 2s\n");
99 else printf(
"Using %d iterations of c += a*b\n", numflops );
100 printf(
"-------------------------------------------------------------------------\n" );
102 printf(
"PAPI_TOT_CYC : \t%10lld\n",
values[0] );
103 printf(
"PAPI_REF_CYC : \t%10lld\n",
values[1] );
104 printf(
"Real usec : \t%10lld\n",
elapsed_us );
106 printf(
"Virt usec : \t%10lld\n", elapsed_virt_us );
107 printf(
"Virt cycles (estimate) : \t%10lld\n", elapsed_virt_cyc );
110 printf(
"-------------------------------------------------------------------------\n" );
116 printf(
"Verification: PAPI_REF_CYC should be much lower than real_usec\n");
119 if (!
quiet) printf(
"PAPI_REF_CYC too high!\n");
120 test_fail( __FILE__, __LINE__,
"PAPI_REF_CYC too high", 0 );
128 printf(
"Verification: real_cyc should be roughly PAPI_REF_CYC\n");
129 printf(
" real_usec should be roughly virt_usec (on otherwise idle system)\n");
136 if ((cycles_error>10.0) || (cycles_error<-10.0)) {
137 if (!
quiet) printf(
"Error of %.2f%%\n",cycles_error);
138 test_fail( __FILE__, __LINE__,
"PAPI_REF_CYC validation", 0 );
145 if ((cycles_error>10.0) || (cycles_error<-10.0)) {
146 if (!
quiet) printf(
"Error of %.2f%%\n",cycles_error);
147 test_warn( __FILE__, __LINE__,
"real_us validation", 0 );
172 if (!
quiet) printf(
"No PAPI_REF_CYC available\n");
174 "PAPI_REF_CYC is not defined on this platform.", 0);
187 "PAPI_add_named_event: PAPI_TOT_CYC",
retval );
194 "PAPI_add_events: PAPI_REF_CYC",
retval );
198 printf(
"Test case sleeping: "
199 "Look at TOT and REF cycles.\n");
206 printf(
"\nTest case busy:\n" );
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
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
get virtual time counter value in clock cycles
get virtual time counter values in microseconds
initialize the PAPI library.
Query if a named PAPI event exists.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static long long values[NUM_EVENTS]
Return codes and api definitions.
static void work(int EventSet, int sleep_test, int quiet)
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 test_warn(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)