This commit is contained in:
Nils Kasulke
2020-04-20 20:05:25 +02:00
parent f036761313
commit c0a88a9f5d

View File

@@ -53,6 +53,7 @@ int main(int argc, char* argv[]) {
per_instruct_ticks = per_instruct_ticks - rc; per_instruct_ticks = per_instruct_ticks - rc;
printf("%u, %u, %lf, %lf\n", n_bytes, array_size, clocks_to_ns(per_instruct_ticks), clocks_to_ns(rc)); printf("%u, %u, %lf, %lf\n", n_bytes, array_size, clocks_to_ns(per_instruct_ticks), clocks_to_ns(rc));
int_to_dev_null(tmp); int_to_dev_null(tmp);
//free not necessary
} }
double clocks_to_ns(double ct) { double clocks_to_ns(double ct) {
return ct / CLOCKS_PER_SEC * 1000000000.0; return ct / CLOCKS_PER_SEC * 1000000000.0;
@@ -101,7 +102,7 @@ double clock_ticks_rand() {
for(size_t i=0; i<N; ++i) { for(size_t i=0; i<N; ++i) {
rand(); rand();
} }
double time_per_rand = (double)(clock() - start) / N; double clock_ticks_per_rand = (double)(clock() - start) / N;
return time_per_rand; return clock_ticks_per_rand;
#undef N #undef N
} }