66main(
int argc,
char **argv )
94 sprintf( add_event_str,
"PAPI_add_event[%s]",
event_name );
219 printf(
"Test case: Start/Stop/Read/Accum/Reset.\n" );
220 printf(
"----------------------------------------------------------------\n" );
222 printf(
"Default domain is: %d (%s)\n",
tmp,
225 printf(
"Default granularity is: %d (%s)\n",
tmp,
227 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
228 printf(
"-------------------------------------------------------------------------\n" );
232 printf(
"1. start,ops,stop %10lld %10lld\n",
values[0][0],
234 printf(
"2. start,ops,stop %10lld %10lld\n",
values[1][0],
236 printf(
"3. reset,start,ops,stop %10lld %10lld\n",
values[2][0],
238 printf(
"4. start,ops/2,read %10lld %10lld\n",
values[3][0],
240 printf(
"5. ops/2,read %10lld %10lld\n",
values[4][0],
242 printf(
"6. ops/2,accum %10lld %10lld\n",
values[5][0],
244 printf(
"7. ops/2,read %10lld %10lld\n",
values[6][0],
246 printf(
"8. reset,ops/2,stop %10lld %10lld\n",
values[7][0],
248 printf(
"9. reset,read %10lld %10lld\n",
values[8][0],
250 printf(
"-------------------------------------------------------------------------\n" );
251 printf(
"Verification:\n" );
252 printf(
"Row 1 approximately equals rows 2 and 3 \n" );
253 printf(
"Row 4 approximately equals 1/2 of row 3\n" );
254 printf(
"Row 5 approximately equals twice row 4\n" );
255 printf(
"Row 6 approximately equals 6 times row 4\n" );
256 printf(
"Rows 7 and 8 approximately equal row 4\n" );
257 printf(
"Row 9 equals 0\n" );
258 printf(
"%% difference between %s 1 & 2: %.2f\n",
"PAPI_TOT_CYC",
259 100.0 * (
float )
values[0][0] / (
float )
values[1][0] );
260 printf(
"%% difference between %s 1 & 2: %.2f\n", add_event_str,
261 100.0 * (
float )
values[0][1] / (
float )
values[1][1] );
264 for (
i = 0;
i <= 1;
i++ ) {
268 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
272 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
276 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
280 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
284 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
288 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
292 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
295 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
Accumulate and reset counters in an EventSet.
Convert a numeric hardware event code to a name.
Get PAPI library or event set options.
initialize the PAPI library.
Read hardware counters from an event set.
Reset the hardware event counts in an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
char event_name[2][PAPI_MAX_STR_LEN]
#define PAPI_2MAX_STR_LEN
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)
int approx_equals(double a, double b)
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)
int add_two_events(int *num_events, int *papi_event, int *mask)
int remove_test_events(int *EventSet, int mask)