Edit: Made messages prettier and added a message which says which version is being benchmarked when called with -B
This commit is contained in:
+16
-7
@@ -27,22 +27,30 @@ void benchmarking(size_t benchmarking_amount, int version_to_use, float complex
|
||||
|
||||
switch (version_to_use)
|
||||
{
|
||||
case 0: // Uses highly optimized SIMD and threaded version / main implementatio
|
||||
case 0: // Uses highly optimized SIMD and threaded version / main implementation
|
||||
printf("Benchmarking V0 - highly optimized SIMD + Threading implementation\n");
|
||||
tricorn_implementation = tricorn;
|
||||
break;
|
||||
case 1: // Uses unoptimised comparison implementation
|
||||
printf("Benchmarking V1 - unoptimized comparison implementation\n");
|
||||
tricorn_implementation = tricorn_V1;
|
||||
break;
|
||||
case 2: // Uses optimized SISD version
|
||||
case 2: // Uses optimized SISD implementation
|
||||
printf("Benchmarking V2 - optimized SISD implementation\n");
|
||||
tricorn_implementation = tricorn_V2;
|
||||
break;
|
||||
case 3: // Uses unoptimized SIMD version
|
||||
case 3: // Uses unoptimized SIMD implementation
|
||||
printf("Benchmarking V3 - unoptimized SIMD implementation\n");
|
||||
tricorn_implementation = tricorn_V3;
|
||||
break;
|
||||
case 4: // Uses highly optimized SIMD
|
||||
printf("Benchmarking V4 - optimized SIMD implementation\n");
|
||||
tricorn_implementation = tricorn_V3;
|
||||
|
||||
tricorn_implementation = tricorn_V4;
|
||||
break;
|
||||
case 5: // Experimental cleanups and inlines / for testing
|
||||
printf("Benchmarking V2 - experimental implementation\n");
|
||||
tricorn_implementation = tricorn_V5;
|
||||
break;
|
||||
default:
|
||||
@@ -50,6 +58,8 @@ void benchmarking(size_t benchmarking_amount, int version_to_use, float complex
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
for (size_t i = 0; i < benchmarking_amount; i++)
|
||||
{
|
||||
@@ -58,9 +68,9 @@ void benchmarking(size_t benchmarking_amount, int version_to_use, float complex
|
||||
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);
|
||||
printf("The total amount of time spent for %zu function calls: %lf seconds\n", benchmarking_amount,time);
|
||||
double average = time / benchmarking_amount;
|
||||
printf("Average time per function:%lf", average);
|
||||
printf("Average time per function: %lf seconds", average);
|
||||
}
|
||||
|
||||
unsigned tests(void) {
|
||||
@@ -326,9 +336,8 @@ int main(int argc, char** argv)
|
||||
|
||||
if (will_benchmark)
|
||||
{
|
||||
printf("\nwill do benchmarking. no images will be created\n");
|
||||
printf("\nDoing benchmarking. No images will be created\n");
|
||||
benchmarking(amount_function_called,version_to_use,complexA,width,height,resolution,n,colored,tempArr);
|
||||
printf("\nbenchmarking done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user