22 int main(
int argc,
char **argv ) {
45 long long dom_default_values[1],
48 dom_userkernel_values[1],
50 long long grn_thr_values[1],grn_proc_values[1];
51 long long grn_sys_values[1],grn_sys_cpu_values[1];
52 long long total_values[1],total_affinity_values[1];
53 long long total_all_values[1];
56 dom_userkernel_values[0]=0;
61 grn_sys_cpu_values[0]=0;
63 total_affinity_values[0]=0;
64 total_all_values[0]=0;
76 printf(
"\nTrying PAPI_TOT_INS with different domains:\n");
93 fprintf(stderr,
"Error trying to add PAPI_TOT_INS\n");
99 printf(
"\tDefault:\t\t\t");
115 printf(
"%lld\n",dom_default_values[0]);
140 "this test; trying to set PAPI_DOM_ALL; need to run as root",
151 fprintf(stderr,
"Error trying to add PAPI_TOT_INS\n");
157 printf(
"\tPAPI_DOM_USER:\t\t\t");
173 printf(
"%lld\n",dom_user_values[0]);
191 domain_opt.def_cidx=0;
192 domain_opt.eventset=EventSetKernel;
199 "this test; trying to set PAPI_DOM_ALL; need to run as root",
210 fprintf(stderr,
"Error trying to add PAPI_TOT_INS\n");
216 printf(
"\tPAPI_DOM_KERNEL:\t\t");
232 printf(
"%lld\n",dom_kernel_values[0]);
243 printf(
"\tPAPI_DOM_USER|PAPI_DOM_KERNEL:\t");
255 domain_opt.def_cidx=0;
256 domain_opt.eventset=EventSetUserKernel;
264 "this test; trying to set PAPI_DOM_ALL; need to run as root",
276 fprintf(stderr,
"Error trying to add PAPI_TOT_INS\n");
294 printf(
"%lld\n",dom_userkernel_values[0]);
304 printf(
"\tPAPI_DOM_ALL:\t\t\t");
316 domain_opt.def_cidx=0;
317 domain_opt.eventset=EventSetAll;
325 "this test; trying to set PAPI_DOM_ALL; need to run as root",
337 fprintf(stderr,
"Error trying to add PAPI_TOT_INS\n");
355 printf(
"%lld\n",dom_all_values[0]);
366 printf(
"\nTrying different granularities:\n");
370 printf(
"\tPAPI_GRN_THR:\t\t\t");
389 "this test; trying to set PAPI_GRN_THR",
397 fprintf(stderr,
"Error trying to add PAPI_TOT_INS\n");
415 printf(
"%lld\n",grn_thr_values[0]);
426 printf(
"\tPAPI_GRN_PROC:\t\t\t");
439 gran_opt.eventset=EventSet5;
445 printf(
"Unable to set PAPI_GRN_PROC\n");
452 printf(
"Error trying to add PAPI_TOT_INS\n");
470 printf(
"%lld\n",grn_proc_values[0]);
483 printf(
"\tPAPI_GRN_SYS:\t\t\t");
496 gran_opt.eventset=EventSet6;
502 printf(
"Unable to set PAPI_GRN_SYS\n");
512 if (!
quiet) printf(
"SYS granularity not allowed, probably perf_event_paranoid permissions\n");
516 printf(
"Error adding PAPI_TOT_INS with system granularity\n");
518 test_fail(__FILE__, __LINE__,
"adding PAPI_TOT_INS with system granularity",
retval);
535 printf(
"%lld\n",grn_sys_values[0]);
549 printf(
"\tPAPI_GRN_SYS_CPU:\t\t");
562 gran_opt.eventset=EventSet7;
568 printf(
"Unable to set PAPI_GRN_SYS_CPU\n");
575 printf(
"Error trying to add PAPI_TOT_INS\n");
593 printf(
"%lld\n",grn_sys_cpu_values[0]);
605 printf(
"\nPAPI_GRN_SYS plus CPU attach:\n");
609 printf(
"\tGRN_SYS, DOM_USER, CPU 0 attach:\t");
622 gran_opt.eventset=EventSet8;
628 printf(
"Unable to set PAPI_GRN_SYS\n");
641 printf(
"Permission error trying to CPU_ATTACH; need to run as root\n");
644 "this test; trying to CPU_ATTACH; need to run as root",
654 printf(
"Error trying to add PAPI_TOT_INS\n");
672 printf(
"%lld\n",total_values[0]);
684 printf(
"\tGRN_SYS, DOM_USER, CPU 0 affinity:\t");
690 retval=sched_setaffinity(0,
sizeof(mask), &mask);
694 printf(
"Setting affinity failed: %s\n",strerror(
errno));
708 gran_opt.eventset=EventSet9;
714 printf(
"Unable to set PAPI_GRN_SYS\n");
731 printf(
"Error trying to add PAPI_TOT_INS\n");
749 printf(
"%lld\n",total_affinity_values[0]);
761 printf(
"\tGRN_SYS, DOM_ALL, CPU 0 affinity:\t");
769 retval=sched_setaffinity(0,
sizeof(mask), &mask);
773 printf(
"Setting affinity failed: %s\n",strerror(
errno));
785 domain_opt.def_cidx=0;
786 domain_opt.eventset=EventSet10;
794 "this test; trying to set PAPI_DOM_ALL; need to run as root",
805 gran_opt.eventset=EventSet10;
811 printf(
"Unable to set PAPI_GRN_SYS\n");
828 printf(
"Error trying to add PAPI_TOT_INS\n");
846 printf(
"%lld\n",total_all_values[0]);
860 printf(
"Validating:\n");
861 printf(
"\tDOM_USER|DOM_KERNEL (%lld) > DOM_USER (%lld)\n",
862 dom_userkernel_values[0],dom_user_values[0]);
864 if (dom_user_values[0] > dom_userkernel_values[0]) {
865 test_fail( __FILE__, __LINE__,
"DOM_USER too high", 0 );
int PAPI_stop(int EventSet, long long *values)
int main(int argc, char **argv)
void test_pass(const char *filename)
PAPI_granularity_option_t granularity
A pointer to the following is passed to PAPI_set/get_opt()
int PAPI_set_opt(int option, PAPI_option_t *ptr)
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 PAPI_library_init(int version)
int PAPI_assign_eventset_component(int EventSet, int cidx)
int PAPI_create_eventset(int *EventSet)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
PAPI_domain_option_t domain
int PAPI_start(int EventSet)