#pragma once #include // Utility Timer template class Stopwatch { typename Clock::time_point start_point; public: Stopwatch() : start_point(Clock::now()) {} // Returns elapsed time template Rep elapsedTime() const { std::atomic_thread_fence(std::memory_order_relaxed); auto counted_time = std::chrono::duration_cast(Clock::now() - start_point).count(); std::atomic_thread_fence(std::memory_order_relaxed); return static_cast(counted_time); } }; using preciseStopwatch = Stopwatch<>;