#include #include #define ARRAY_SIZE 1024 #define NUMBER_OF_TRIALS 1000000 /* * Statically allocate our arrays. Compilers can * align them correctly. */ static double a[ARRAY_SIZE], b[ARRAY_SIZE], c; int main(int argc, char *argv[]) { int i,t; double m = 1.0001; /* Populate A and B arrays */ for (i=0; i < ARRAY_SIZE; i++) { b[i] = i; a[i] = i+1; } /* Perform an operation a number of times */ for (t=0; t < NUMBER_OF_TRIALS; t++) { for (i=0; i < ARRAY_SIZE; i++) { c += m*a[i] + b[i]; } } return 0; }