blob: ccf7122fc5d3d8788c29026f40312e60428c93e8 [file] [log] [blame]
#ifndef VTR_TIME_H
#define VTR_TIME_H
#include <chrono>
#include <string>
namespace vtr {
class ScopedTimer {
public:
ScopedTimer();
//No copy
ScopedTimer(ScopedTimer&) = delete;
ScopedTimer& operator=(ScopedTimer&) = delete;
//No move
ScopedTimer(ScopedTimer&&) = delete;
ScopedTimer& operator=(ScopedTimer&&) = delete;
float elapsed_sec();
private:
using clock = std::chrono::steady_clock;
std::chrono::time_point<clock> start_;
};
class ScopedPrintTimer : public ScopedTimer {
public:
ScopedPrintTimer(const std::string action);
~ScopedPrintTimer();
private:
const std::string action_;
};
}
#endif