27#define TAB_DOM "%s%12lld%15lld%17lld\n"
39 long long min, max, min2, max2;
42 printf(
"-----------------------------------------------------------------\n" );
43 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
44 printf(
"-------------------------------------------------------------\n" );
46 if ( test_case ==
CASE2 ) {
48 printf(
"Test type : Before Create Before Add Between Adds\n" );
53 printf(
"-------------------------------------------------------------\n" );
54 printf(
"Verification:\n" );
55 printf(
"Both rows equal 'n N N' where n << N\n" );
58 }
else if ( test_case ==
CHANGE ) {
62 test_fail( __FILE__, __LINE__,
"PAPI_TOT_INS", 1 );
68 test_fail( __FILE__, __LINE__,
"PAPI_TOT_CYC", 1 );
71 printf(
"Test type : PAPI_DOM_ALL PAPI_DOM_KERNEL PAPI_DOM_USER\n" );
76 printf(
"-------------------------------------------------------------\n" );
78 printf(
"Verification:\n" );
79 printf(
"Both rows approximately equal '(N+n) n N', where n << N\n" );
80 printf(
"Column 1 approximately equals column 2 plus column 3\n" );
84 printf(
"Test type : PAPI_DOM_ALL All-minus-supervisor Supervisor-only\n" );
89 printf(
"-------------------------------------------------------------\n" );
90 printf(
"Verification:\n" );
91 printf(
"Both rows approximately equal '(N+n) n N', where n << N\n" );
92 printf(
"Column 1 approximately equals column 2 plus column 3\n" );
100 (
long long ) ( (
double ) ( double )
values[0][1] *
104 printf(
"Test type : PAPI_DOM_ALL PAPI_DOM_KERNEL PAPI_DOM_USER\n" );
109 printf(
"-------------------------------------------------------------\n" );
110 printf(
"Verification:\n" );
111 printf(
"Both rows approximately equal '(N+n) n N', where n << N\n" );
112 printf(
"Column 1 approximately equals column 2 plus column 3\n" );
115 test_fail( __FILE__, __LINE__,
"PAPI_TOT_INS", 1 );
119 test_fail( __FILE__, __LINE__,
"PAPI_TOT_CYC", 1 );
125 "Verify non-zero count for all domain types", 1 );
129 if (!
TESTS_QUIET) printf(
"WARNING: No events counted in supervisor context. This is expected in a non-virtualized environment.\n" );
132 "Verify non-zero count for all domain types", 1 );
156 if ( cmpinfo == NULL ) {
182 test_fail( __FILE__, __LINE__,
"PAPI_assign_eventset_component",
186 if (!
TESTS_QUIET) printf(
"\nTest case CREATE: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet before add\n" );
201 options.domain.eventset = EventSet3;
211 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_INS)",
retval );
215 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_CYC)",
retval );
219 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_INS)",
retval );
223 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_CYC)",
retval );
227 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_INS)",
retval );
230 if (!
TESTS_QUIET) printf(
"\nTest case MIDDLE: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet between adds\n" );
246 options.domain.eventset = EventSet3;
256 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_CYC)",
retval );
259 if (!
TESTS_QUIET) printf(
"\nTest case ADD: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet after add\n" );
274 options.domain.eventset = EventSet3;
291 if (!
TESTS_QUIET) printf(
"\nTest case CHANGE 1: Change domain on EventSet between runs, using generic domain options:\n" );
331 if (!
TESTS_QUIET) printf(
"\nTest case CHANGE 2: Change domain on EventSets to include/exclude supervisor events:\n" );
352 test_fail( __FILE__, __LINE__,
"PAPI_set_domain ALL^SUPERVISOR ",
retval );
360 test_fail( __FILE__, __LINE__,
"PAPI_set_domain SUPERVISOR ",
retval );
456 printf(
"\nTest case 2, CREATE: Call PAPI_set_domain(%s) before create\n",
458 printf(
"This should override the domain setting for this EventSet.\n" );
471 printf(
"\nTest case 2, ADD: Call PAPI_set_domain(%s) before add\n",
473 printf(
"This should have no effect on the domain setting for this EventSet.\n" );
483 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_INS)",
retval );
487 printf(
"\nTest case 2, MIDDLE: Call PAPI_set_domain(%s) between adds\n",
489 printf(
"This should have no effect on the domain setting for this EventSet.\n" );
499 test_fail( __FILE__, __LINE__,
"PAPI_add_event(PAPI_TOT_CYC)",
retval );
562#if defined(sgi) && defined(host_mips)
566 printf(
"IRIX requires root for PAPI_DOM_KERNEL and PAPI_DOM_ALL.\n" );
572 printf(
"Test second.c: set domain of eventset via PAPI_set_domain and PAPI_set_opt.\n\n" );
573 printf(
"* PAPI_set_domain(DOMAIN) sets the default domain \napplied to subsequently created EventSets.\n" );
574 printf(
"It should have no effect on existing EventSets.\n\n" );
575 printf(
"* PAPI_set_opt(DOMAIN,xxx) sets the domain for a specific EventSet.\n" );
576 printf(
"It should always override the default setting for that EventSet.\n" );
add PAPI preset or native hardware event to an event set
Assign a component index to an existing but empty EventSet.
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
get information about a specific software component
initialize the PAPI library.
Query if PAPI event exists.
Set the default counting domain for new event sets bound to the cpu component.
Set PAPI library or event set options.
Finish using PAPI and free all related resources.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_DOM_SUPERVISOR
static long long values[NUM_EVENTS]
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
char * stringify_domain(int domain)
void free_test_space(long long **values, int num_tests)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
long long ** allocate_test_space(int num_tests, int num_events)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
void dump_and_verify(int test_case, long long **values)
A pointer to the following is passed to PAPI_set/get_opt()
PAPI_domain_option_t domain