From bbb296ac4bb5a0e5071fd7de421417f4aaef88e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Sun, 1 Sep 2013 03:19:29 +0200 Subject: [PATCH] Added measurements to both programs to put them head to head. --- main.c | 6 ++++++ mandel_classic.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 4f39e02..30b8ccd 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,8 @@ #include #include +#include + #ifdef __APPLE__ #include #else @@ -130,6 +132,8 @@ int main(int argn, char **argv) { else stop_point = -2.5; + clock_t start = clock(); + while(zoom > stop_point) { for (current_line = 0; current_line < res_y; current_line++) @@ -219,6 +223,8 @@ int main(int argn, char **argv) { SDL_Flip(screen); } + printf("Time elapsed %0.5f seconds\n", ((double)clock() - start) / CLOCKS_PER_SEC); + // Clean up ret = clFlush(command_queue); ret = clFinish(command_queue); diff --git a/mandel_classic.c b/mandel_classic.c index d65bc5c..968147d 100644 --- a/mandel_classic.c +++ b/mandel_classic.c @@ -4,6 +4,8 @@ #include #include +#include + #include #define MAX_SOURCE_SIZE (0x100000) @@ -386,6 +388,9 @@ int main(int argn, char **argv) else stop_point = -2.5; + // We measure the time to do the zooming + clock_t start = clock(); + while(zoom > stop_point) { int iteration, max_iteration, x, y, res; @@ -465,7 +470,7 @@ int main(int argn, char **argv) SDL_Flip(screen); } - // printf("Max Iteration value: %d\n", max_iter); + printf("Time elapsed %0.5f seconds\n", ((double)clock() - start) / CLOCKS_PER_SEC); SDL_Event ev; int active;