14main(
int argc,
char **argv )
21 const char *
event_names[] = {
"PAPI_TOT_CYC",
"PAPI_TOT_INS"};
41 if (!
quiet) printf(
"Trouble querying events\n");
53 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[0] );
59 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[1] );
95 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[0] );
101 sprintf( add_event_str,
"PAPI_add_named_event[%s]",
event_names[1] );
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" );
117 printf(
"Test type : \t 1\n" );
120 sprintf( add_event_str,
"%-12s : \t",
event_names[0] );
122 sprintf( add_event_str,
"%-12s : \t",
event_names[1] );
127 printf(
TAB1,
"Virt usec : \t", elapsed_virt_us );
128 printf(
TAB1,
"Virt cycles : \t", elapsed_virt_cyc );
130 printf(
"-------------------------------------------------------------------------\n" );
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 );
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]
Return codes and api definitions.
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)