Timing sections of your code and showing the results
Our new Timer class uses the C++ chrono library, a specialized part of C++ dealing with clocks, durations, and points in time.
You can find the example code of this section in the 03_opengl_ui_timer and 07_vulkan_ui_timer folders.
Adding the Timer class
Create the new Timer class by adding the Timer.h file in the tools folder:
#pragma once #include <chrono> After the header guard, we include the chrono header. The elements from the chrono header can be found in the std::chrono namespace.
Next, add the Timer class itself in the Timer.h file:
class Timer { public: void start(); float stop(); private: bool mRunning = false; std::chrono::time_point<std::chrono::steady_clock> mStartTime{}; }; The Timer class has two public methods: the start() method...