diff --git a/apps/chapter_05.cpp b/apps/chapter_05.cpp index f3cfdbe..343cd01 100644 --- a/apps/chapter_05.cpp +++ b/apps/chapter_05.cpp @@ -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 #include #include @@ -37,6 +38,7 @@ #define kWallZ 10 using namespace Raytracer; +using namespace std; /* ------------------------------------------------------------------------- */ @@ -86,6 +88,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 the_start, the_end; + printf("Chapter 05 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 the_elapsed_time = the_end - the_start; + printf("Execution Time: %f secondes\n", the_elapsed_time.count()); + + return the_ret; } diff --git a/apps/chapter_06.cpp b/apps/chapter_06.cpp index b94e817..9bb290e 100644 --- a/apps/chapter_06.cpp +++ b/apps/chapter_06.cpp @@ -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 #include #include @@ -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 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 the_elapsed_time = the_end - the_start; + printf("Execution Time: %f secondes\n", the_elapsed_time.count()); + + return the_ret; } diff --git a/apps/chapter_07.cpp b/apps/chapter_07.cpp index 17e97d0..f256e75 100644 --- a/apps/chapter_07.cpp +++ b/apps/chapter_07.cpp @@ -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 #include #include @@ -33,6 +34,7 @@ /* ------------------------------------------------------------------------- */ using namespace Raytracer; +using namespace std; /* ------------------------------------------------------------------------- */ @@ -43,6 +45,8 @@ int main(void) Canvas the_canvas; Sphere *the_floor, *the_left_wall, *the_right_wall; Sphere *the_middle, *the_right, *the_left; + chrono::time_point the_start, the_end; + printf("Chapter 07 example.\n"); // Floor is an extremely flattened sphere with a matte texture. @@ -100,9 +104,14 @@ int main(void) the_camera.set_transform( Matrix::view_transform(Tuple::Point(0, 1.5, -5), Tuple::Point(0, 1, 0), Tuple::Vector(0, 1, 0))); + the_start = chrono::high_resolution_clock::now(); the_canvas = the_camera.render(the_world); + the_end = chrono::high_resolution_clock::now(); the_canvas.save_to_file("chapter07.ppm"); + chrono::duration the_elapsed_time = the_end - the_start; + printf("Execution Time: %f secondes\n", the_elapsed_time.count()); + return 0; }