#include <SgTimer.h>
For checking the elapsed time, without calling SgTime::Get each time.
Definition at line 17 of file 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 |
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 75 of file SgTimer.h.
References SgTime::Get(), m_isStopped, m_timeStart, and m_timeStop.
Referenced by SgSearch::AbortSearch(), SgUctSearch::CheckAbortSearch(), 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 82 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 87 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 107 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 113 of file SgTimer.h.
References SgTime::Get(), IsStopped(), m_isStopped, m_timeStart, m_timeStop, and SG_ASSERT.
Referenced by SgBookBuilder::Expand(), SgBookBuilder::IncreaseWidth(), SgBookBuilder::Refresh(), and SgSearch::StopTime().
std::size_t SgTimer::m_counter [private] |
bool SgTimer::m_isStopped [private] |
bool SgTimer::m_isTimeOut [private] |
double SgTimer::m_timeStart [private] |
double SgTimer::m_timeStop [private] |