/* * A simple example ofthe use of the high level PAPI_flops call. * PAPI_flops measures elapsed time, process time, floating point * instructions and MFLOP/s for code bracketted by calls to this routine. * For the following matrix multiply you should get 2*(INDEX^3) flpins * on Intel Pentium processors. */ #include #include #include #include #include #include #include #include "papi.h" #define INDEX 100 static void test_fail(char *file, int line, char *call, int retval); int main(int argc, char **argv) { extern void dummy(void *); float matrixa[INDEX][INDEX], matrixb[INDEX][INDEX], mresult[INDEX][INDEX]; float real_time, proc_time, mflops; long long flpins; int retval; int i,j,k; /* Initialize the Matrix arrays */ for ( i=0; i 0 ) { printf("Error calculating: %s\n", call ); } else { char errstring[PAPI_MAX_STR_LEN]; PAPI_perror(retval, errstring, PAPI_MAX_STR_LEN ); printf("Error in %s: %s\n", call, errstring ); } printf("\n"); exit(1); }