22 long long overflow_vector,
void *context ) {
26 ( void ) overflow_vector;
29 fprintf(
stderr,
"handler(%d ) Overflow at %p! bit=%#llx \n",
30 EventSet, address, overflow_vector );
38 if (!
quiet) printf(
"%15lld %15lld %18lld %15lld %.3fms\n",
44 if (!
quiet) printf(
"RAPL decreased!\n");
61 if (!
quiet) printf(
"do_ints result: %d\n",
c);
67main(
int argc,
char **argv )
70 long long values0[2],values1[2],values2[2];
71 int num_flops = 30000000,
retval;
75 int cid,numcmp,rapl_cid;
90 for(cid=0; cid<numcmp; cid++) {
93 test_fail(__FILE__, __LINE__,
"PAPI_get_component_info failed\n", 0);
96 if (strstr(cmpinfo->
name,
"rapl")) {
98 if (!
TESTS_QUIET) printf(
"Found rapl component at cid %d\n",
101 test_skip(__FILE__,__LINE__,
"No rapl events found",0);
109 test_skip(__FILE__,__LINE__,
"No rapl component found\n",0);
137 char raplEventBase[]=
"rapl:::PACKAGE_ENERGY_CNT:PACKAGE";
141 sprintf(buffer,
"%s%d", raplEventBase,
i);
146 }
while ( 0 <
retval &&
i < 64 );
154 printf(
"Using %#x for the overflow event on PAPI_TOT_CYC, threshold %d\n",
175 printf(
"%15s %15s %18s %15s Elapsed\n",
"PAPI_TOT_CYC",
"PAPI_TOT_INS",
176 "PACKAGE_ENERGY_CNT",
"--UNUSED--");
221 printf(
"%s: %lld(Calibration) %lld(OverflowRun)\n",event_name1,values0[0],values1[0]);
230 printf(
"%s: %lld(Calibration) %lld(OverflowRun)\n",event_name1,values0[1],values1[1]);
244 test_fail(__FILE__, __LINE__,
"RAPL counts went backward!",0);
add PAPI preset or native hardware event to an event set
add PAPI preset or native hardware event by name to an EventSet
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Convert a numeric hardware event code to a name.
get information about a specific software component
Get real time counter value in nanoseconds.
initialize the PAPI library.
Get the number of components available on the system.
Set up an event set to begin registering overflows.
Read hardware counters from an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static long long mythreshold
static double c[MATRIX_SIZE][MATRIX_SIZE]
Return codes and api definitions.
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 long long old_rapl_values[2]
void do_ints(int n, int quiet)
static long long values[2]
void handler(int EventSet, void *address, long long overflow_vector, void *context)
static long long after_time
static long long rapl_values[2]
static long long before_time
char name[PAPI_MAX_STR_LEN]