20#define OVER_FMT "handler(%d) Overflow at %p! vector=%#llx\n"
21#define OUT_FMT "%-12s : %18lld%18lld%18lld\n"
22#define VEC_FMT " at vector %#llx, event %-12s : %6d\n"
34 { {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}} };
38handler(
int mode,
void *address,
long long overflow_vector,
void *context )
49 for (
i = 0;
i < 3;
i++ ) {
58 for (
i = 0;
i < 3;
i++ ) {
76 handler( 0, address, overflow_vector, context );
84 handler( 1, address, overflow_vector, context );
89main(
int argc,
char **argv )
117 if (!
quiet) printf(
"No events found!\n");
118 test_skip( __FILE__, __LINE__,
"no PAPI_event", 0 );
161 printf(
"PAPI_get_overflow_event_index error: %s\n",
169 printf(
"PAPI_get_overflow_event_index error: %s\n",
202 printf(
"PAPI_get_overflow_event_index error: %s\n",
210 printf(
"PAPI_get_overflow_event_index error: %s\n",
230 printf(
"Test case: Overflow dispatch of both events in set with 2 events.\n" );
231 printf(
"---------------------------------------------------------------\n" );
232 printf(
"Threshold for overflow is: %d\n",
threshold );
233 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
234 printf(
"-----------------------------------------------\n" );
236 printf(
"Test type : %18s%18s%18s\n",
"1 (no overflow)",
"2 (batch)",
244 printf(
"Predicted overflows at event %-12s : %6d\n",
event_name[0],
246 printf(
"Predicted overflows at event %-12s : %6d\n",
event_name[1],
249 printf(
"\nBatch overflows (add, add, over, over):\n" );
250 for ( k = 0; k < 2; k++ ) {
257 printf(
"\nInterleaved overflows (add, over, add, over):\n" );
258 for ( k = 0; k < 2; k++ ) {
266 printf(
"\nCases 2+3 Unknown overflows: %d\n",
total_unknown );
267 printf(
"-----------------------------------------------\n" );
271 test_fail( __FILE__, __LINE__,
"a batch counter had no overflows", 1 );
275 "an interleaved counter had no overflows", 1 );
278 test_fail( __FILE__, __LINE__,
"Unknown counter had overflows", 1 );
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Convert a numeric hardware event code to a name.
converts an overflow vector into an array of indexes to overflowing events
initialize the PAPI library.
Set up an event set to begin registering overflows.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
char event_name[2][PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
static ocount_t overflow_counts[2][3]
static void handler(int mode, void *address, long long overflow_vector, void *context)
static void handler_interleaf(int EventSet, void *address, long long overflow_vector, void *context)
static void handler_batch(int EventSet, void *address, long long overflow_vector, void *context)
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
int find_nonderived_event(void)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)