44#define OVER_FMT "handler(%d) Overflow at %p overflow_vector=%#llx!\n"
45#define OUT_FMT "%-12s : %16lld%16d%16lld\n"
47#define SOFT_TOLERANCE 0.90
67main(
int argc,
char **argv )
70 long long hard_min, hard_max, soft_min, soft_max;
89 if ( info.
count == 1 ||
90 !strcmp( info.
derived,
"DERIVED_CMPD" ) )
97 if ( info.
count == 1 ||
98 !strcmp( info.
derived,
"DERIVED_CMPD" ) )
105 if ( info.
count == 1 ||
106 !strcmp( info.
derived,
"DERIVED_CMPD" ) )
112 test_skip( __FILE__, __LINE__,
"No suitable event for this test found!",
117 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 2 );
139 "Platform does not support Hardware overflow", 0 );
204 memset( &itimer, 0,
sizeof ( itimer ) );
236 memset( &itimer, 0,
sizeof ( itimer ) );
271 (
"Test case: Software overflow of various types with 1 event in set.\n" );
273 (
"------------------------------------------------------------------------------\n" );
274 printf(
"Threshold for overflow is: %d\n",
mythreshold );
276 (
"------------------------------------------------------------------------------\n" );
278 printf(
"Test type : %11s%13s%13s%13s%13s\n",
"Reference",
"Hardware",
279 "ITIMER_PROF",
"ITIMER_VIRT",
"ITIMER_REAL" );
280 printf(
"%-12s: %11lld%13lld%13lld%13lld%13lld\n", info.
symbol,
282 printf(
"Overflows : %11d%13d%13d%13d%13d\n",
total[0],
total[1],
285 (
"------------------------------------------------------------------------------\n" );
287 printf(
"Verification:\n" );
290 (
"Overflow in Column 2 greater than or equal to overflows in Columns 3, 4, 5\n" );
291 printf(
"Overflow in Columns 3, 4, 5 greater than 0\n" );
307 if (
total[1] > hard_max ||
total[1] < hard_min )
308 test_fail( __FILE__, __LINE__,
"Hardware Overflows outside limits", 1 );
310 if (
total[2] > soft_max ||
total[3] > soft_max ||
total[4] > soft_max )
312 "Software Overflows exceed theoretical maximum", 1 );
314 if (
total[2] < soft_min ||
total[3] < soft_min ||
total[4] < soft_min )
315 printf(
"WARNING: Software Overflow occurring but suspiciously low\n" );
318 test_fail( __FILE__, __LINE__,
"Software Overflows", 1 );
static const PAPI_hw_info_t * hw_info
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
Convert a numeric hardware event code to a name.
Get the event's name and description info.
get information about the system hardware
Get PAPI library or event set options.
initialize the PAPI library.
Set up an event set to begin registering overflows.
Query if PAPI event exists.
Set PAPI library or event set options.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static long long mythreshold
char event_name[2][PAPI_MAX_STR_LEN]
#define PAPI_OVERFLOW_FORCE_SW
#define PAPI_COMPONENTINFO
static int total[MY_NUM_TESTS]
static long long values[MY_NUM_TESTS]
void handler(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)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char symbol[PAPI_HUGE_STR_LEN]
char derived[PAPI_MIN_STR_LEN]
A pointer to the following is passed to PAPI_set/get_opt()
PAPI_itimer_option_t itimer