22int 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]);
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");
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");
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");
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");
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");
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");
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));
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));
794 "this test; trying to set PAPI_DOM_ALL; need to run as root",
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 );
add PAPI preset or native hardware event by name to an EventSet
Assign a component index to an existing but empty EventSet.
Create a new empty PAPI EventSet.
initialize the PAPI library.
Set PAPI library or event set options.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
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)
A pointer to the following is passed to PAPI_set/get_opt()