Added measurements to both programs to put them head to head.

This commit is contained in:
José Carlos Cuevas 2013-09-01 03:19:29 +02:00
parent f2f4a1c9cd
commit bbb296ac4b
2 changed files with 12 additions and 1 deletions

6
main.c
View file

@ -2,6 +2,8 @@
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#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);

View file

@ -4,6 +4,8 @@
#include <pthread.h>
#include <math.h>
#include <time.h>
#include <SDL.h>
#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;