Classes | |
class | wall_clock |
Class for measuring time intervals. More... | |
Functions | |
wall_clock::wall_clock () | |
wall_clock::~wall_clock () | |
void | wall_clock::tic () |
start the timer | |
double | wall_clock::toc () |
return the number of seconds since the last call to tic() |
wall_clock::wall_clock | ( | ) | [inline, inherited] |
Definition at line 22 of file wall_clock_meat.hpp.
00023 : valid(false) 00024 { 00025 arma_extra_debug_sigprint(); 00026 }
wall_clock::~wall_clock | ( | ) | [inline, inherited] |
Definition at line 31 of file wall_clock_meat.hpp.
void wall_clock::tic | ( | ) | [inline, inherited] |
start the timer
Definition at line 40 of file wall_clock_meat.hpp.
References arma_stop(), boost_time1, posix_time1, and valid.
00041 { 00042 arma_extra_debug_sigprint(); 00043 00044 #if defined(ARMA_USE_BOOST_DATE) 00045 { 00046 boost_time1 = boost::posix_time::microsec_clock::local_time(); 00047 valid = true; 00048 } 00049 #else 00050 #if defined(ARMA_HAVE_GETTIMEOFDAY) 00051 { 00052 gettimeofday(&posix_time1, 0); 00053 valid = true; 00054 } 00055 #else 00056 { 00057 arma_stop("wall_clock::tic(): need Boost libraries or POSIX gettimeofday()"); 00058 } 00059 #endif 00060 #endif 00061 }
double wall_clock::toc | ( | ) | [inline, inherited] |
return the number of seconds since the last call to tic()
Definition at line 67 of file wall_clock_meat.hpp.
References arma_stop(), boost_duration, boost_time1, posix_time1, posix_time2, and valid.
00068 { 00069 arma_extra_debug_sigprint(); 00070 00071 if(valid) 00072 { 00073 #if defined(ARMA_USE_BOOST_DATE) 00074 { 00075 boost_duration = boost::posix_time::microsec_clock::local_time() - boost_time1; 00076 return boost_duration.total_microseconds() * 1e-6; 00077 } 00078 #else 00079 #if defined(ARMA_HAVE_GETTIMEOFDAY) 00080 { 00081 gettimeofday(&posix_time2, 0); 00082 00083 const double tmp_time1 = posix_time1.tv_sec + posix_time1.tv_usec * 1.0e-6; 00084 const double tmp_time2 = posix_time2.tv_sec + posix_time2.tv_usec * 1.0e-6; 00085 00086 return tmp_time2 - tmp_time1; 00087 } 00088 #else 00089 { 00090 arma_stop("wall_clock::toc(): need Boost libraries or POSIX gettimeofday()"); 00091 return 0.0; 00092 } 00093 #endif 00094 #endif 00095 } 00096 else 00097 { 00098 return 0.0; 00099 } 00100 }