Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Private Member Functions | Private Attributes

SgTimer Class Reference

Timer. More...

#include <SgTimer.h>

List of all members.

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

Detailed Description

Timer.

For checking the elapsed time, without calling SgTime::Get each time.

Definition at line 15 of file SgTimer.h.


Constructor & Destructor Documentation

SgTimer::SgTimer (  ) 

Constructor.

Also starts the timer.

Definition at line 62 of file SgTimer.h.

References Start().

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

Not implemented.


Member Function Documentation

double SgTimer::GetTime (  )  const
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.

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

Member Data Documentation

std::size_t SgTimer::m_counter [private]

Definition at line 50 of file SgTimer.h.

Referenced by IsTimeOut().

bool SgTimer::m_isStopped [private]

Definition at line 45 of file SgTimer.h.

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

bool SgTimer::m_isTimeOut [private]

Definition at line 47 of file SgTimer.h.

Referenced by IsTimeOut().

double SgTimer::m_timeStart [private]

Definition at line 53 of file SgTimer.h.

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

double SgTimer::m_timeStop [private]

Definition at line 56 of file SgTimer.h.

Referenced by GetTime(), and Stop().


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


Sun Mar 13 2011 Doxygen 1.7.1