[ADD] Add measurement for chapters

This commit is contained in:
NADAL Jean-Baptiste
2024-02-27 18:18:40 +01:00
parent 429fa3f743
commit 38e34f3b2c
3 changed files with 37 additions and 2 deletions

View File

@@ -26,6 +26,7 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
#include <chrono>
#include <cstdio>
#include <raytracing.h>
@@ -37,6 +38,7 @@
#define kWallZ 10
using namespace Raytracer;
using namespace std;
/* ------------------------------------------------------------------------- */
@@ -93,6 +95,17 @@ int shadow_sphere(uint8_t a_canvas_pixels, double a_wall_size, uint8_t a_wall_z)
int main(void)
{
int the_ret;
chrono::time_point<chrono::high_resolution_clock> the_start, the_end;
printf("Chapter 06 example.\n");
return shadow_sphere(kImageSize, kWallSize, kWallZ);
the_start = chrono::high_resolution_clock::now();
the_ret = shadow_sphere(kImageSize, kWallSize, kWallZ);
the_end = chrono::high_resolution_clock::now();
chrono::duration<double> the_elapsed_time = the_end - the_start;
printf("Execution Time: %f secondes\n", the_elapsed_time.count());
return the_ret;
}