15{
21 const char *
event_names[] = {
"PAPI_TOT_CYC",
"PAPI_TOT_INS"};
23 double cycles_error;
25
26
28
29
33 }
34
35
39 }
41 if (!
quiet) printf(
"Trouble querying events\n");
43 }
44
45
49
50
53 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[0] );
55 }
56
59 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[1] );
61 }
62
64
65
70
71
75 }
76
77
79
80
84 }
85
86
91
92
95 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[0] );
97 }
98
101 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[1] );
103 }
104
106 printf( "PAPI_{query, add, remove}_named_event API test.\n" );
107 printf( "-----------------------------------------------\n" );
109 printf(
"Default domain is: %d (%s)\n",
tmp,
112 printf(
"Default granularity is: %d (%s)\n",
tmp,
114 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
115 printf( "-------------------------------------------------------------------------\n" );
116
117 printf( "Test type : \t 1\n" );
118
119
120 sprintf( add_event_str,
"%-12s : \t",
event_names[0] );
122 sprintf( add_event_str,
"%-12s : \t",
event_names[1] );
124
127 printf(
TAB1,
"Virt usec : \t", elapsed_virt_us );
128 printf(
TAB1,
"Virt cycles : \t", elapsed_virt_cyc );
129
130 printf( "-------------------------------------------------------------------------\n" );
131
132 printf( "Verification: PAPI_TOT_CYC should be roughly real_cycles\n" );
135 if (cycles_error>10.0) {
136 printf("Error of %.2f%%\n",cycles_error);
137 test_fail( __FILE__, __LINE__,
"validation", 0 );
138 }
139
140 }
142
143 return 0;
144}
static const char * event_names[2]
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
Get PAPI library or event set options.
get real time counter value in clock cycles Returns the total real time passed since some arbitrary s...
get real time counter value in microseconds
get virtual time counter value in clock cycles
get virtual time counter values in microseconds
initialize the PAPI library.
Query if a named PAPI event exists.
removes a named hardware event from a PAPI event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
char * stringify_all_domains(int domains)
char * stringify_granularity(int granularity)
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)