Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1
2
3#pragma once
4#include <chrono>
5
8class Timer
9{
10private:
11 using Clock = std::chrono::steady_clock;
12 using Second = std::chrono::duration<double, std::ratio<1> >;
13
14 std::chrono::time_point<Clock> m_beg { Clock::now() };
15
16public:
18 void reset()
19 {
20 m_beg = Clock::now();
21 }
22
24 double elapsed() const
25 {
26 return std::chrono::duration_cast<Second>(Clock::now() - m_beg).count();
27 }
28};
Implementation by Alex: https://www.learncpp.com/cpp-tutorial/timing-your-code/.
Definition Timer.h:9
double elapsed() const
Seconds elapsed since construction or the last reset().
Definition Timer.h:24
void reset()
Restarts the stopwatch from now.
Definition Timer.h:18