1 #include "time_observer.h" 2 #include "caffe2/core/logging.h" 6 void TimeObserver::Start() {
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";
17 void TimeOperatorObserver::Start() {
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";
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));
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
float MilliSeconds()
Returns the elapsed time in milliseconds.