14int main(
int argc,
char **argv ) {
17 char *instructions_event=NULL;
20 char user_event[BUFSIZ];
21 char kernel_event[BUFSIZ];
22 char user_kernel_event[BUFSIZ];
31 int EventSet_default_user_kernel =
PAPI_NULL;
32 long long default_values[1];
33 long long default_user_values[1];
34 long long default_kernel_values[1];
35 long long default_user_kernel_values[1];
41 int EventSet_user_user_kernel =
PAPI_NULL;
42 long long user_values[1];
43 long long user_user_values[1];
44 long long user_kernel_values[1];
45 long long user_user_kernel_values[1];
51 int EventSet_kernel_user_kernel =
PAPI_NULL;
52 long long kernel_values[1];
53 long long kernel_user_values[1];
54 long long kernel_kernel_values[1];
55 long long kernel_user_kernel_values[1];
62 long long all_values[1];
63 long long all_user_values[1];
64 long long all_kernel_values[1];
65 long long all_user_kernel_values[1];
69 long long two_values[2];
85 if (instructions_event==NULL) {
87 "No instructions event definition for this arch",
91 sprintf(user_event,
"%s:u=1",instructions_event);
92 sprintf(kernel_event,
"%s:k=1",instructions_event);
93 sprintf(user_kernel_event,
"%s:u=1:k=1",instructions_event);
100 printf(
"\tTwo Events in same EventSet\n");
119 fprintf(
stderr,
"Error trying to add %s\n",kernel_event);
137 printf(
"\t\t%s count = %lld, %s count = %lld\n",
138 user_event,two_values[0],
139 kernel_event,two_values[1]);
148 printf(
"\tDefault Domain\n");
160 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
178 printf(
"\t\t%s count = %lld\n",instructions_event,default_values[0]);
195 fprintf(
stderr,
"Error trying to add %s\n",user_event);
213 printf(
"\t\t%s count = %lld\n",user_event,default_user_values[0]);
229 fprintf(
stderr,
"Error trying to add %s\n",kernel_event);
247 printf(
"\t\t%s count = %lld\n",kernel_event,default_kernel_values[0]);
264 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
276 retval =
PAPI_stop( EventSet_default_user_kernel, default_user_kernel_values );
282 printf(
"\t\t%s count = %lld\n",user_kernel_event,default_user_kernel_values[0]);
290 printf(
"\tPAPI_DOM_USER Domain\n");
304 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
322 printf(
"\t\t%s count = %lld\n",instructions_event,user_values[0]);
339 fprintf(
stderr,
"Error trying to add %s\n",user_event);
357 printf(
"\t\t%s count = %lld\n",user_event,user_user_values[0]);
373 fprintf(
stderr,
"Error trying to add %s\n",user_event);
391 printf(
"\t\t%s count = %lld\n",kernel_event,user_kernel_values[0]);
407 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
419 retval =
PAPI_stop( EventSet_user_user_kernel, user_user_kernel_values );
425 printf(
"\t\t%s count = %lld\n",user_kernel_event,user_user_kernel_values[0]);
433 printf(
"\tPAPI_DOM_KERNEL Domain\n");
447 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
465 printf(
"\t\t%s count = %lld\n",instructions_event,kernel_values[0]);
482 fprintf(
stderr,
"Error trying to add %s\n",user_event);
500 printf(
"\t\t%s count = %lld\n",user_event,kernel_user_values[0]);
516 fprintf(
stderr,
"Error trying to add %s\n",user_event);
534 printf(
"\t\t%s count = %lld\n",kernel_event,kernel_kernel_values[0]);
550 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
562 retval =
PAPI_stop( EventSet_kernel_user_kernel, kernel_user_kernel_values );
568 printf(
"\t\t%s count = %lld\n",user_kernel_event,kernel_user_kernel_values[0]);
576 printf(
"\tPAPI_DOM_ALL Domain\n");
590 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
608 printf(
"\t\t%s count = %lld\n",instructions_event,all_values[0]);
625 fprintf(
stderr,
"Error trying to add %s\n",user_event);
643 printf(
"\t\t%s count = %lld\n",user_event,all_user_values[0]);
659 fprintf(
stderr,
"Error trying to add %s\n",user_event);
677 printf(
"\t\t%s count = %lld\n",kernel_event,all_kernel_values[0]);
693 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
705 retval =
PAPI_stop( EventSet_all_user_kernel, all_user_kernel_values );
711 printf(
"\t\t%s count = %lld\n",user_kernel_event,all_user_kernel_values[0]);
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Set the default counting domain for new event sets bound to the specified component.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
char event_name[2][PAPI_MAX_STR_LEN]
char * get_instructions_event(char *event, int 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)