1 #ifndef CAFFE2_CORE_TIMER_H_ 2 #define CAFFE2_CORE_TIMER_H_ 6 #include "caffe2/core/common.h" 18 typedef std::chrono::high_resolution_clock clock;
19 typedef std::chrono::nanoseconds ns;
24 inline void Start() { start_time_ = clock::now(); }
25 inline float NanoSeconds() {
26 return std::chrono::duration_cast<ns>(clock::now() - start_time_).count();
39 inline float Seconds() {
return NanoSeconds() / 1000000000.f; }
42 std::chrono::time_point<clock> start_time_;
43 DISABLE_COPY_AND_ASSIGN(
Timer);
47 #endif // CAFFE2_CORE_TIMER_H_ float Seconds()
Returns the elapsed time in seconds.
float MilliSeconds()
Returns the elapsed time in milliseconds.
float MicroSeconds()
Returns the elapsed time in microseconds.
A simple timer object for measuring time.
Simple registry implementation in Caffe2 that uses static variables to register object creators durin...
void Start()
Starts a timer.