Timer Class Reference

A stopwatch-style timer. More...

#include <Timer.h++>

List of all members.

Public Member Functions

 Timer () throw ()
 Construct a new Timer.
virtual ~Timer () throw ()
 Destructor.
void start () throw ()
 Start the timer.
void stop () throw ()
 Stop the timer.
void pause () throw ()
 Pause the timer.
void resume () throw ()
 Resume the timer.
void reset () throw ()
 Reset the timer.
uint64_t elapsedKernelTime () const throw ()
 Return the total elapsed kernel time for this timer (up to the point where the timer was last stopped) in milliseconds.
uint64_t elapsedUserTime () const throw ()
 Return the total elapsed user time for this timer (up to the point where the timer was last stopped) in milliseconds.
uint64_t elapsedRealTime () const throw ()
 Return the total elapsed real time for this timer (up to the point where the timer was last stopped) in milliseconds.
bool isRunning () const throw ()
 Determine if this timer is running.

Detailed Description

A stopwatch-style timer.

The timer can be used for code benchmarking and other timing tasks. The timer accumulates time while it is "running"; this accumulated time (in kernel time, user time, and real time) can be queried while the timer is stopped.

Author:
Mark Lindner

Constructor & Destructor Documentation

Timer (  )  throw ()

Construct a new Timer.

~Timer (  )  throw () [virtual]

Destructor.


Member Function Documentation

uint64_t elapsedKernelTime (  )  const throw () [inline]

Return the total elapsed kernel time for this timer (up to the point where the timer was last stopped) in milliseconds.

uint64_t elapsedRealTime (  )  const throw () [inline]

Return the total elapsed real time for this timer (up to the point where the timer was last stopped) in milliseconds.

uint64_t elapsedUserTime (  )  const throw () [inline]

Return the total elapsed user time for this timer (up to the point where the timer was last stopped) in milliseconds.

bool isRunning (  )  const throw () [inline]

Determine if this timer is running.

void pause (  )  throw () [inline]

Pause the timer.

Attempting to pause a timer that isn't running will have no effect. Equivalent to stop().

void reset (  )  throw ()

Reset the timer.

All elapsed times are cleared to 0.

void resume (  )  throw () [inline]

Resume the timer.

Attempting to resume a timer that isn't paused will have no effect. Equivalent to start().

void start (  )  throw ()

Start the timer.

Attemping to start an already running timer will have no effect.

void stop (  )  throw ()

Stop the timer.

Attempting to stop a timer that isn't running will have no effect.


The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3