#ifndef _COMMON_PROFILER_HPP_ #define _COMMON_PROFILER_HPP_ #include class Profiler { public: Profiler(); virtual ~Profiler(); void start(void); long end(void); long elapsed(void); private: std::chrono::_V2::system_clock::time_point start_time = std::chrono::high_resolution_clock::now(); }; inline Profiler::Profiler() { } inline Profiler::~Profiler() { } inline void Profiler::start(void) { start_time = std::chrono::high_resolution_clock::now(); } inline long Profiler::end(void) { std::chrono::_V2::system_clock::time_point end_time = std::chrono::high_resolution_clock::now(); long elapsed_time_ms = std::chrono::duration_cast(end_time - start_time).count(); return elapsed_time_ms; } inline long Profiler::elapsed(void) { return end(); } #endif