21 long long overflow_vector,
void *context ) {
25 ( void ) overflow_vector;
28 fprintf( stderr,
"handler(%d ) Overflow at %p! bit=%#llx \n",
29 EventSet, address, overflow_vector );
39 if (!
quiet) printf(
"RAPL decreased!\n");
57 if (!
quiet) printf(
"%d\n",
c);
63 main(
int argc,
char **argv )
66 long long values0[2],values1[2],values2[2];
67 int num_flops = 3000000,
retval;
71 int cid,numcmp,rapl_cid;
86 for(cid=0; cid<numcmp; cid++) {
89 test_fail(__FILE__, __LINE__,
"PAPI_get_component_info failed\n", 0);
92 if (strstr(cmpinfo->
name,
"rapl")) {
94 if (!
TESTS_QUIET) printf(
"Found rapl component at cid %d\n",
97 test_skip(__FILE__,__LINE__,
"No rapl events found",0);
105 test_skip(__FILE__,__LINE__,
"No rapl component found\n",0);
135 sprintf(&(
buffer[0]),
"rapl:::PACKAGE_ENERGY:PACKAGE%d",
i);
140 }
while ( 0 <
retval &&
i < 64 );
147 printf(
"Using %#x for the overflow event, threshold %d\n",
208 printf(
"%s: %lld %lld\n",event_name1,values0[0],values1[0]);
217 printf(
"%s: %lld %lld\n",event_name1,values0[1],values1[1]);
231 test_fail(__FILE__, __LINE__,
"RAPL counts went backward!",0);
int PAPI_stop(int EventSet, long long *values)
static long long values[2]
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
void test_pass(const char *filename)
int PAPI_add_event(int EventSet, int EventCode)
int PAPI_num_components(void)
int PAPI_overflow(int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler)
Return codes and api definitions.
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_add_named_event(int EventSet, const char *EventName)
int main(int argc, char **argv)
int PAPI_library_init(int version)
char name[PAPI_MAX_STR_LEN]
static long long rapl_values[2]
void handler(int EventSet, void *address, long long overflow_vector, void *context)
int PAPI_cleanup_eventset(int EventSet)
int PAPI_create_eventset(int *EventSet)
int PAPI_event_code_to_name(int EventCode, char *out)
void do_ints(int n, int quiet)
static long long old_rapl_values[2]
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
int PAPI_destroy_eventset(int *EventSet)
int PAPI_read(int EventSet, long long *values)
static long long mythreshold
int PAPI_start(int EventSet)