Files
triton/bench/common.hpp

34 lines
595 B
C++
Raw Normal View History

#ifndef ISAAC_BENCH_COMMON_HPP_
#define ISAAC_BENCH_COMMON_HPP_
2014-11-06 07:07:27 -05:00
2015-08-13 17:19:07 -07:00
#include <chrono>
2014-11-06 07:07:27 -05:00
2015-08-13 17:19:07 -07:00
class Timer
{
typedef std::chrono::high_resolution_clock high_resolution_clock;
typedef std::chrono::nanoseconds nanoseconds;
public:
explicit Timer(bool run = false)
{
if (run)
start();
}
void start()
{
_start = high_resolution_clock::now();
}
nanoseconds get() const
{
return std::chrono::duration_cast<nanoseconds>(high_resolution_clock::now() - _start);
}
private:
high_resolution_clock::time_point _start;
};
2014-11-06 07:07:27 -05:00
2014-11-06 07:07:27 -05:00
#endif