26#define OVRFLOW 5000000
27#define LOWERFLOW (OVRFLOW - (OVRFLOW/100))
28#define UPPERFLOW (OVRFLOW/100)
29#define ERRORFLOW (UPPERFLOW/5)
37 long long vals[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
39 printf(
"\nOverflow at %p! bit=%#llx \n", address, overflow_vector );
41 printf(
"Overflow read vals :" );
42 for (
i = 0;
i < 3 ;
i++ )
43 printf(
"%lld ", vals[
i] );
49main(
int argc,
char *argv[] )
56 long long lwrflow = 0, error, max_error = 0;
57 long long vals[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
68 printf(
"ovf_info = %d (%#x)\n",
options.ovf_info.type,
74 printf(
"sub_info->hardware_intr = %d\n\n",
75 options2.sub_info->hardware_intr );
83#if ((defined(linux) && (defined(__i386__) || (defined __x86_64__))) )
84 if ( !strncmp( hwinfo->
model_string,
"Intel Pentium 4", 15 ) ) {
86 }
else if ( !strncmp( hwinfo->
model_string,
"AMD K7", 6 ) ) {
88 }
else if ( !strncmp( hwinfo->
model_string,
"AMD K8", 6 ) ) {
90 }
else if ( !strncmp( hwinfo->
model_string,
"Intel Core", 10 ) ) {
102 test_fail( __FILE__, __LINE__,
"PAPI_add_event:PAPI_TOT_INS",
retval );
105 test_fail( __FILE__, __LINE__,
"PAPI_add_event:PAPI_TOT_CYC",
retval );
119 for (
i = 0;
i < 1000000;
i++ ) {
120 if (
i % 1000 == 0 ) {
127 printf(
"Main loop read vals :" );
128 for (
i = 0;
i < 3 ;
i++ )
129 printf(
"%lld ", vals[
i] );
132 error =
ovrflow - ( lwrflow + vals[0] ) / 2;
133 printf(
"Difference: %lld\n", error );
135 if ( abs( error ) > max_error )
136 max_error = abs( error );
141 printf(
"---------------------\n" );
158 printf(
"Verification:\n" );
160 (
"Maximum absolute difference between overflow value\nand adjacent measured values is: %lld\n",
163 printf(
"This exceeds the error limit: %d\n",
ERRORFLOW );
164 test_fail( __FILE__, __LINE__,
"Overflows", 1 );
166 printf(
"This is within the error limit: %d\n",
ERRORFLOW );
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
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.
Read hardware counters from an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
void handler(int EventSet, void *address, long long overflow_vector, void *context)
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)
char model_string[PAPI_MAX_STR_LEN]
A pointer to the following is passed to PAPI_set/get_opt()