Caffe2 - C++ API
A deep learning, cross platform ML framework
time_observer.cc
1 #include "time_observer.h"
2 #include "caffe2/core/logging.h"
3 
4 namespace caffe2 {
5 
6 void TimeObserver::Start() {
7  start_time_ = timer_.MilliSeconds();
8  ++iterations_;
9 }
10 
11 void TimeObserver::Stop() {
12  double current_run = timer_.MilliSeconds() - start_time_;
13  total_time_ += current_run;
14  VLOG(1) << "This net iteration took " << current_run << " ms to complete.\n";
15 }
16 
17 void TimeOperatorObserver::Start() {
18  start_time_ = timer_.MilliSeconds();
19  ++iterations_;
20 }
21 
22 void TimeOperatorObserver::Stop() {
23  double current_run = timer_.MilliSeconds() - start_time_;
24  total_time_ += current_run;
25  VLOG(1) << "This operator iteration took " << current_run
26  << " ms to complete.\n";
27 }
28 
29 std::unique_ptr<ObserverBase<OperatorBase>> TimeOperatorObserver::rnnCopy(
30  OperatorBase* subject,
31  int rnn_order) const {
32  return std::unique_ptr<ObserverBase<OperatorBase>>(
33  new TimeOperatorObserver(subject, nullptr));
34 }
35 
36 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13
float MilliSeconds()
Returns the elapsed time in milliseconds.
Definition: timer.h:32