Removed: Wierd benchmarking switch statement
This commit is contained in:
+18
-38
@@ -28,60 +28,40 @@ unsigned tests(void) {
|
||||
void benchmarking(size_t benchmarking_amount, int version_to_use, float complex complexA, size_t width, ssize_t height, float resolution, unsigned n, _Bool colored, unsigned char *tempArr) {
|
||||
struct timespec start;
|
||||
struct timespec end;
|
||||
switch (version_to_use)
|
||||
void (*tricorn_implementation)(float complex, size_t, ssize_t, float, unsigned, _Bool, unsigned char*);
|
||||
|
||||
switch (version_to_use)
|
||||
{
|
||||
case 0: // Uses highly optimized SIMD and threaded version / main implementation
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
case 0: // Uses highly optimized SIMD and threaded version / main implementatio
|
||||
tricorn_implementation = tricorn;
|
||||
break;
|
||||
case 1: // Uses unoptimised comparison implementation
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn_V1(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
tricorn_implementation = tricorn_V1;
|
||||
break;
|
||||
case 2: // Uses optimized SISD version
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn_V2(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
tricorn_implementation = tricorn_V2;
|
||||
break;
|
||||
case 3: // Uses unoptimized SIMD version
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn_V3(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
tricorn_implementation = tricorn_V3;
|
||||
break;
|
||||
case 4: // Uses highly optimized SIMD
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn_V4(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
tricorn_implementation = tricorn_V4;
|
||||
break;
|
||||
case 5: // Experimental cleanups and inlines / for testing
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn_V5(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
tricorn_implementation = tricorn_V5;
|
||||
break;
|
||||
default:
|
||||
printf("Invalid version to use");
|
||||
return;
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
tricorn_implementation(complexA,width,height,resolution,n,colored,tempArr);
|
||||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
|
||||
double time = end.tv_sec- start.tv_sec + 1e-9 * (end.tv_nsec- start.tv_nsec);
|
||||
printf("The total amount of time spent for %zu function calls: %lf\n", benchmarking_amount,time);
|
||||
double average = time / benchmarking_amount;
|
||||
|
||||
Reference in New Issue
Block a user