17main(
int argc,
char **argv )
37 test_skip(__FILE__, __LINE__,
"Multiplex not supported", 1);
61 sprintf( add_event_str,
"PAPI_add_event[%s]",
event_name );
186 printf(
"Test case: Start/Stop/Read/Accum/Reset.\n" );
187 printf(
"----------------------------------------------------------------\n" );
189 printf(
"Default domain is: %d (%s)\n",
tmp,
192 printf(
"Default granularity is: %d (%s)\n",
tmp,
194 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
195 printf(
"-------------------------------------------------------------------------\n" );
199 printf(
"1. start,ops,stop %10lld %10lld\n",
values[0][0],
201 printf(
"2. start,ops,stop %10lld %10lld\n",
values[1][0],
203 printf(
"3. reset,start,ops,stop %10lld %10lld\n",
values[2][0],
205 printf(
"4. start,ops/2,read %10lld %10lld\n",
values[3][0],
207 printf(
"5. ops/2,read %10lld %10lld\n",
values[4][0],
209 printf(
"6. ops/2,accum %10lld %10lld\n",
values[5][0],
211 printf(
"7. ops/2,read %10lld %10lld\n",
values[6][0],
213 printf(
"8. reset,ops/2,stop %10lld %10lld\n",
values[7][0],
215 printf(
"9. reset,read %10lld %10lld\n",
values[8][0],
217 printf(
"-------------------------------------------------------------------------\n" );
218 printf(
"Verification:\n" );
219 printf(
"Row 1 approximately equals rows 2 and 3 \n" );
220 printf(
"Row 4 approximately equals 1/2 of row 3\n" );
221 printf(
"Row 5 approximately equals twice row 4\n" );
222 printf(
"Row 6 approximately equals 6 times row 4\n" );
223 printf(
"Rows 7 and 8 approximately equal row 4\n" );
224 printf(
"Row 9 equals 0\n" );
225 printf(
"%% difference between %s 1 & 2: %.2f\n",
"PAPI_TOT_CYC",
226 100.0 * (
float )
values[0][0] / (
float )
values[1][0] );
227 printf(
"%% difference between %s 1 & 2: %.2f\n", add_event_str,
228 100.0 * (
float )
values[0][1] / (
float )
values[1][1] );
231 for (
i = 0;
i <= 1;
i++ ) {
235 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
239 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
243 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
247 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
251 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
255 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
259 ( (
i == 0 ) ?
"PAPI_TOT_CYC" : add_event_str ), 1 );
262 ( (
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.
Initialize multiplex support in the PAPI library.
Read hardware counters from an event set.
Reset the hardware event counts in an event set.
Convert a standard event set to a multiplexed 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)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
int remove_test_events(int *EventSet, int mask)