Timer. More...
#include <SgTimer.h>
Public Member Functions | |
SgTimer () | |
Constructor. | |
double | GetTime () const |
Get elapsed time. | |
bool | IsStopped () const |
bool | IsTimeOut (double maxTime, std::size_t checkFreq=16) |
Check for timeout. | |
void | Start () |
Reset timer. | |
void | Stop () |
Stop timer. | |
Private Member Functions | |
SgTimer (const SgTimer &timer) | |
Not implemented. | |
Private Attributes | |
bool | m_isStopped |
bool | m_isTimeOut |
std::size_t | m_counter |
double | m_timeStart |
double | m_timeStop |
Timer.
For checking the elapsed time, without calling SgTime::Get each time.
Definition at line 15 of file SgTimer.h.
SgTimer::SgTimer | ( | ) |
SgTimer::SgTimer | ( | const SgTimer & | timer | ) | [private] |
Not implemented.
double SgTimer::GetTime | ( | ) | const |
Get elapsed time.
Returns time since last start or between last start and stop if timer is stopped.
Definition at line 72 of file SgTimer.h.
References SgTime::Get(), m_isStopped, m_timeStart, and m_timeStop.
Referenced by SgSearch::AbortSearch(), SgUctSearch::CheckAbortSearch(), SgBookBuilder::Cover(), SgBookBuilder::Expand(), SgSearch::GetStatistics(), SgBookBuilder::IncreaseWidth(), SgSearch::IteratedSearch(), SgUctSearch::OnSearchIteration(), SgBookBuilder::Refresh(), SgUctSearch::Search(), SgUctSearch::SearchOnePly(), and SgUctSearch::StartSearch().
bool SgTimer::IsStopped | ( | ) | const |
Definition at line 79 of file SgTimer.h.
References m_isStopped.
Referenced by Stop(), and SgSearch::StopTime().
bool SgTimer::IsTimeOut | ( | double | maxTime, | |
std::size_t | checkFreq = 16 | |||
) |
Check for timeout.
This function can only be used with fixed parameters per instance of SgTimer.
maxTime | ||
checkFreq | Do the comparison only every n calls for efficiency. |
Definition at line 84 of file SgTimer.h.
References SgTime::Get(), m_counter, m_isTimeOut, and m_timeStart.
Referenced by SgUctTree::CopySubtree().
void SgTimer::Start | ( | ) |
Reset timer.
Definition at line 104 of file SgTimer.h.
References SgTime::Get(), m_isStopped, and m_timeStart.
Referenced by SgUctSearch::Search(), SgUctSearch::SearchOnePly(), SgTimer(), and SgSearch::StartTime().
void SgTimer::Stop | ( | ) |
Stop timer.
Definition at line 110 of file SgTimer.h.
References SgTime::Get(), IsStopped(), m_isStopped, m_timeStart, m_timeStop, and SG_ASSERT.
Referenced by SgBookBuilder::Cover(), SgBookBuilder::Expand(), SgBookBuilder::IncreaseWidth(), SgBookBuilder::Refresh(), and SgSearch::StopTime().
std::size_t SgTimer::m_counter [private] |
Definition at line 50 of file SgTimer.h.
Referenced by IsTimeOut().
bool SgTimer::m_isStopped [private] |
bool SgTimer::m_isTimeOut [private] |
Definition at line 47 of file SgTimer.h.
Referenced by IsTimeOut().
double SgTimer::m_timeStart [private] |
double SgTimer::m_timeStop [private] |