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 static_cast<float>(
27 std::chrono::duration_cast<ns>(clock::now() - start_time_).count());
40 inline float Seconds() {
return NanoSeconds() / 1000000000.f; }
43 std::chrono::time_point<clock> start_time_;
44 C10_DISABLE_COPY_AND_ASSIGN(
Timer);
48 #endif // CAFFE2_CORE_TIMER_H_ void Start()
Starts a timer.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
float MilliSeconds()
Returns the elapsed time in milliseconds.
float Seconds()
Returns the elapsed time in seconds.
float MicroSeconds()
Returns the elapsed time in microseconds.
A simple timer object for measuring time.