#include #include #include //prints out usage information void usage(); //generate dynamically allocated array, initialized with rand() int* rand_array(size_t n); //converts clock ticks to nano seconds double clocks_to_ns(double ct); //write to /dev/null or nul //exits if it fails void int_to_dev_null(int trash); //calculates the clock ticks rand() probably needs //from a hot cache double clock_ticks_rand(); int main(int argc, char* argv[]) { if(argc != 4) { usage(); return 1; } unsigned n_bytes; unsigned array_size; unsigned n_times_access; unsigned n_loops; sscanf(argv[1], "%u", &n_bytes); sscanf(argv[2], "%u", &n_times_access); sscanf(argv[3], "%u", &n_loops); srand(time(NULL)); array_size = n_bytes / 4; int* parry = rand_array(array_size); clock_t start; clock_t end; clock_t overall = 0; int tmp = 0; double rc = clock_ticks_rand(); for(size_t n=0; n array-size n-times-access n-loops\n"); } double clock_ticks_rand() { #define N 1000000 for(size_t i=0; i