|
Anasazi Version of the Day
|
00001 #include <Tsqr_StatTimeMonitor.hpp> 00002 00005 00006 namespace TSQR { 00007 00008 StatTimeMonitor::StatTimeMonitor (Teuchos::Time& timer, TimeStats& stats) 00009 : timer_ (timer), stats_ (stats) 00010 { 00011 if (timer_.isRunning()) 00012 timer_.stop(); // Just for sanity 00013 if (timer_.numCalls() == 0) 00014 stats_.init(); 00015 timer_.start (true); 00016 } 00017 00018 StatTimeMonitor::~StatTimeMonitor () 00019 { 00020 const double curTime = timer_.stop(); 00021 stats_.update (curTime); 00022 } 00023 00024 #if 0 00025 00026 00027 00028 00029 00030 static double 00031 fetchTime (const Teuchos::RCP< Teuchos::Time >& timer) 00032 { 00033 if (timer->isRunning()) 00034 timer->stop(); 00035 return timer->totalElapsedTime(); 00036 } 00037 #endif // 0 00038 00039 00040 } // namespace TSQR
1.7.4