#include <Timer.h>
Classes | |
struct | CPUTime |
Public Member Functions | |
Timer () | |
~Timer () | |
void | start (const char *msg=0) |
void | restart (const char *msg=0) |
void | check (const char *msg=0) |
bool | is_running () const |
double | get_elapsed_cpu_time () const |
uint64_t | get_elapsed_cpu_time_microseconds () const |
double | get_elapsed_wall_time () const |
uint64_t | get_elapsed_wall_time_microseconds () const |
std::string | ToString () const |
Definition at line 12 of file Timer.h.
MosesTuning::Timer::Timer | ( | ) | [inline] |
void Timer::check | ( | const char * | msg = 0 |
) |
Print out an optional message followed by the current timer timing.
Definition at line 94 of file Timer.cpp.
References get_elapsed_cpu_time(), get_elapsed_wall_time(), and TRACE_ERR.
Referenced by MosesTuning::PrintUserTime().
double Timer::get_elapsed_cpu_time | ( | ) | const |
Return the total time in seconds that the timer has been in the "running" state since it was first "started" or last "restarted". For "short" time periods (less than an hour), the actual cpu time used is reported instead of the elapsed time.
Definition at line 52 of file Timer.cpp.
References get_elapsed_cpu_time_microseconds().
Referenced by check(), and MosesTuning::GetUserTime().
uint64_t Timer::get_elapsed_cpu_time_microseconds | ( | ) | const |
Return the total time in microseconds.
Definition at line 57 of file Timer.cpp.
References util::CPUTime().
Referenced by get_elapsed_cpu_time().
double Timer::get_elapsed_wall_time | ( | ) | const |
Get elapsed wall-clock time in seconds.
Definition at line 65 of file Timer.cpp.
References get_elapsed_wall_time_microseconds().
Referenced by BOOST_AUTO_TEST_CASE(), check(), and ToString().
uint64_t Timer::get_elapsed_wall_time_microseconds | ( | ) | const |
Get elapsed wall-clock time in microseconds.
Definition at line 70 of file Timer.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and get_elapsed_wall_time().
bool MosesTuning::Timer::is_running | ( | ) | const [inline] |
Definition at line 64 of file Timer.h.
Referenced by BOOST_AUTO_TEST_CASE(), and MosesTuning::operator<<().
void Timer::restart | ( | const char * | msg = 0 |
) |
Restart the timer iff the timer is already running. if the timer is not running, just start the timer.
Definition at line 85 of file Timer.cpp.
References TRACE_ERR.
Referenced by BOOST_AUTO_TEST_CASE().
void Timer::start | ( | const char * | msg = 0 |
) |
Start a timer. If it is already running, let it continue running. Print an optional message.
Definition at line 75 of file Timer.cpp.
References TRACE_ERR.
Referenced by BOOST_AUTO_TEST_CASE(), and MosesTuning::ResetUserTime().
std::string Timer::ToString | ( | ) | const |
Return a string that has the user CPU time, system time, and total time.
Definition at line 107 of file Timer.cpp.
References util::CPUTime(), and get_elapsed_wall_time().
Referenced by BOOST_AUTO_TEST_CASE(), and MosesTuning::operator<<().