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 21 of file wall_clock_meat.hpp.
00022 : valid(false) 00023 { 00024 arma_extra_debug_sigprint(); 00025 }
wall_clock::~wall_clock | ( | ) | [inline, inherited] |
void wall_clock::tic | ( | ) | [inline, inherited] |
start the timer
Definition at line 39 of file wall_clock_meat.hpp.
References boost_time1, posix_time1, and valid.
00040 { 00041 arma_extra_debug_sigprint(); 00042 00043 #if defined(ARMA_USE_BOOST) 00044 { 00045 boost_time1 = boost::posix_time::microsec_clock::local_time(); 00046 } 00047 #else 00048 { 00049 gettimeofday(&posix_time1, 0); 00050 } 00051 #endif 00052 00053 valid = true; 00054 }
double wall_clock::toc | ( | ) | [inline, inherited] |
return the number of seconds since the last call to tic()
Definition at line 60 of file wall_clock_meat.hpp.
References boost_duration, boost_time1, posix_time1, posix_time2, and valid.
00061 { 00062 arma_extra_debug_sigprint(); 00063 00064 if(valid) 00065 { 00066 #if defined(ARMA_USE_BOOST) 00067 { 00068 boost_duration = boost::posix_time::microsec_clock::local_time() - boost_time1; 00069 return boost_duration.total_microseconds() * 1e-6; 00070 } 00071 #else 00072 { 00073 gettimeofday(&posix_time2, 0); 00074 00075 const double tmp_time1 = posix_time1.tv_sec + posix_time1.tv_usec * 1.0e-6; 00076 const double tmp_time2 = posix_time2.tv_sec + posix_time2.tv_usec * 1.0e-6; 00077 00078 return tmp_time2 - tmp_time1; 00079 } 00080 #endif 00081 } 00082 else 00083 { 00084 return 0.0; 00085 } 00086 }