Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgTimer Class Reference

#include <SgTimer.h>

List of all members.


Detailed Description

Timer.

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


Constructor & Destructor Documentation

SgTimer::SgTimer (  ) 

Constructor.

Also starts the timer.

Definition at line 67 of file SgTimer.h.

References Start().

SgTimer::SgTimer ( const SgTimer timer  )  [private]

Not implemented.


Member Function Documentation

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.

Parameters:
maxTime 
checkFreq Do the comparison only every n calls for efficiency.
Todo:
The timeout functionality should be extracted to a separate class SgTimeout, which takes maxTime as constructor arguments.

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().


Member Data Documentation

std::size_t SgTimer::m_counter [private]

Definition at line 55 of file SgTimer.h.

Referenced by IsTimeOut().

bool SgTimer::m_isStopped [private]

Definition at line 50 of file SgTimer.h.

Referenced by GetTime(), IsStopped(), Start(), and Stop().

bool SgTimer::m_isTimeOut [private]

Definition at line 52 of file SgTimer.h.

Referenced by IsTimeOut().

double SgTimer::m_timeStart [private]

Definition at line 58 of file SgTimer.h.

Referenced by GetTime(), IsTimeOut(), Start(), and Stop().

double SgTimer::m_timeStop [private]

Definition at line 61 of file SgTimer.h.

Referenced by GetTime(), and Stop().


The documentation for this class was generated from the following file:


17 Jun 2010 Doxygen 1.4.7