Timer Class Reference

A class for measuring process time in ticks or seconds. More...

#include <Timer.hh>

List of all members.

Public Member Functions

 Timer ()
 Default constructor.
void start ()
 Starts the clock without resetting it.
void stop ()
 Stops the clock (can be restarted).
void snapshot ()
 Records the current time between start and this function call.
void reset ()
 Reset the clock.
clock_t real_ticks () const
 Real time in ticks.
clock_t user_ticks () const
 CPU time in ticks.
clock_t sys_ticks () const
 System time in ticks.
clock_t user_sys_ticks () const
 Total (CPU plus system) time in ticks.
float real_sec () const
 Real time in seconds.
float user_sec () const
 CPU time in seconds.
float sys_sec () const
 System time in seconds.
float user_sys_sec () const
 Total (CPU plus sytem) time in seconds.

Protected Attributes

clock_t m_final_real_ticks
clock_t m_final_user_ticks
clock_t m_final_sys_ticks
clock_t m_temp_real_ticks
clock_t m_temp_user_ticks
clock_t m_temp_sys_ticks
clock_t m_real_start
clock_t m_user_start
clock_t m_sys_start
long m_ticks_per_sec
bool m_running


Detailed Description

A class for measuring process time in ticks or seconds.

If ticks or seconds are needed while the timer is running, call snapshot() first, and then request ticks or seconds WHILE the timer is still running. After stop() call, the functions always return the stop time.


Constructor & Destructor Documentation

Timer::Timer  )  [inline]
 

Default constructor.


Member Function Documentation

float Timer::real_sec  )  const [inline]
 

Real time in seconds.

clock_t Timer::real_ticks  )  const [inline]
 

Real time in ticks.

void Timer::reset  )  [inline]
 

Reset the clock.

void Timer::snapshot  )  [inline]
 

Records the current time between start and this function call.

void Timer::start  )  [inline]
 

Starts the clock without resetting it.

void Timer::stop  )  [inline]
 

Stops the clock (can be restarted).

float Timer::sys_sec  )  const [inline]
 

System time in seconds.

clock_t Timer::sys_ticks  )  const [inline]
 

System time in ticks.

float Timer::user_sec  )  const [inline]
 

CPU time in seconds.

float Timer::user_sys_sec  )  const [inline]
 

Total (CPU plus sytem) time in seconds.

clock_t Timer::user_sys_ticks  )  const [inline]
 

Total (CPU plus system) time in ticks.

clock_t Timer::user_ticks  )  const [inline]
 

CPU time in ticks.


Member Data Documentation

clock_t Timer::m_final_real_ticks [protected]
 

clock_t Timer::m_final_sys_ticks [protected]
 

clock_t Timer::m_final_user_ticks [protected]
 

clock_t Timer::m_real_start [protected]
 

bool Timer::m_running [protected]
 

clock_t Timer::m_sys_start [protected]
 

clock_t Timer::m_temp_real_ticks [protected]
 

clock_t Timer::m_temp_sys_ticks [protected]
 

clock_t Timer::m_temp_user_ticks [protected]
 

long Timer::m_ticks_per_sec [protected]
 

clock_t Timer::m_user_start [protected]
 


The documentation for this class was generated from the following file:
Generated on Mon Jan 8 15:51:04 2007 for bit by  doxygen 1.4.6