Caffe2 - C++ API
A deep learning, cross platform ML framework
time_observer.cc
1 
17 #include "time_observer.h"
18 #include "caffe2/core/logging.h"
19 
20 namespace caffe2 {
21 
22 void TimeObserver::Start() {
23  start_time_ = timer_.MilliSeconds();
24  ++iterations_;
25 }
26 
27 void TimeObserver::Stop() {
28  double current_run = timer_.MilliSeconds() - start_time_;
29  total_time_ += current_run;
30  VLOG(1) << "This net iteration took " << current_run << " ms to complete.\n";
31 }
32 
33 void TimeOperatorObserver::Start() {
34  start_time_ = timer_.MilliSeconds();
35  ++iterations_;
36 }
37 
38 void TimeOperatorObserver::Stop() {
39  double current_run = timer_.MilliSeconds() - start_time_;
40  total_time_ += current_run;
41  VLOG(1) << "This operator iteration took " << current_run
42  << " ms to complete.\n";
43 }
44 
45 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.
float MilliSeconds()
Returns the elapsed time in milliseconds.
Definition: timer.h:48