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] );
49 main(
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 );
int PAPI_stop(int EventSet, long long *values)
void test_pass(const char *filename)
int PAPI_add_event(int EventSet, int EventCode)
int PAPI_overflow(int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler)
A pointer to the following is passed to PAPI_set/get_opt()
int PAPI_library_init(int version)
int PAPI_get_opt(int option, PAPI_option_t *ptr)
char model_string[PAPI_MAX_STR_LEN]
int main(int argc, char *argv[])
int PAPI_cleanup_eventset(int EventSet)
int PAPI_create_eventset(int *EventSet)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
int PAPI_destroy_eventset(int *EventSet)
void handler(int EventSet, void *address, long long overflow_vector, void *context)
int PAPI_read(int EventSet, long long *values)
int PAPI_start(int EventSet)
const PAPI_hw_info_t * PAPI_get_hardware_info(void)