Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Static Public Member Functions | Private Types | Private Attributes | Static Private Attributes

StopWatch Class Reference
[System]

StopWatch Class. More...

#include <OpenMS/SYSTEM/StopWatch.h>

List of all members.

Public Member Functions

Constructors and Destructors

 StopWatch ()
 StopWatch (const StopWatch &stop_watch)
virtual ~StopWatch ()

void clear ()
bool start ()
bool stop ()
void reset ()
Readout of the StopWatch

DoubleReal getClockTime () const
DoubleReal getUserTime () const
DoubleReal getSystemTime () const
DoubleReal getCPUTime () const
Assignment

StopWatchoperator= (const StopWatch &stop_watch)
Predicates

bool isRunning () const
bool operator== (const StopWatch &stop_watch) const
bool operator!= (const StopWatch &stop_watch) const
bool operator< (const StopWatch &stop_watch) const
bool operator<= (const StopWatch &stop_watch) const
bool operator>= (const StopWatch &stop_watch) const
bool operator> (const StopWatch &stop_watch) const

Static Public Member Functions

static String toString (DoubleReal time)

Private Types

typedef clock_t TimeType

Private Attributes

bool is_running_
PointerSizeInt start_secs_
PointerSizeInt start_usecs_
TimeType start_user_time_
TimeType start_system_time_
PointerSizeInt current_secs_
PointerSizeInt current_usecs_
TimeType current_user_time_
TimeType current_system_time_

Static Private Attributes

static PointerSizeInt cpu_speed_

Detailed Description

StopWatch Class.

This class is used to determine the current process time.


Member Typedef Documentation

typedef clock_t TimeType [private]

Constructor & Destructor Documentation

StopWatch (  ) 

Default constructor. Create a new stop watch. The stop watch is stopped.

StopWatch ( const StopWatch stop_watch  ) 

Copy constructor. Create a new stop watch from an existing stop watch.

virtual ~StopWatch (  )  [virtual]

Destructor. Destructs a stop watch object.


Member Function Documentation

void clear (  ) 

Starting, Stopping and Resetting the stop watch Clear and stop the stop watch. This sets the stop watch to zero and stops it when running.

See also:
reset
DoubleReal getClockTime (  )  const

Get clock time. Return the accumulated clock (real) time in seconds.

Referenced by main().

DoubleReal getCPUTime (  )  const [inline]

Get CPU time. Return the accumulated CPU time in seconds. CPU time is the sum of user time and system time.

Referenced by StopWatch::operator<().

DoubleReal getSystemTime (  )  const

Get user time. Return the accumulated system time in seconds.

DoubleReal getUserTime (  )  const

Get user time. Return the accumulated user time in seconds.

bool isRunning (  )  const [inline]

Return true if the stop watch is running.

Returns:
bool true if the stop watch is running, false otherwise
bool operator!= ( const StopWatch stop_watch  )  const [inline]

Inequality operator. Return false if two stop watchs differ in any way, i.e. they differ in either the clock, user, or system time or have a different running status.

Parameters:
stop_watch the stop watch to compare with
Returns:
bool true on inequality, false otherwise
bool operator< ( const StopWatch stop_watch  )  const [inline]

Lesser than operator. Return true, if the stop watch is in all timings lesser than the stop watch to be compared with (clock, user and system time).

Parameters:
stop_watch the stop watch to compare with
Returns:
bool true if all times are lesser

References StopWatch::getCPUTime().

bool operator<= ( const StopWatch stop_watch  )  const [inline]

Lesser or equal operator. Return true, if the stop watch is in all timings lesser or equal than the stop watch to be compared with (clock, user and system time).

Parameters:
stop_watch the stop watch to compare with
Returns:
bool true if all times are lesser or equal
StopWatch& operator= ( const StopWatch stop_watch  ) 

Assignment operator. Assigns a stop watch from another. The two stop watch will then run synchronously.

Returns:
StopWatch *this
bool operator== ( const StopWatch stop_watch  )  const

Equality operator. Return true if two stop watchs are equal, i.e. they contain exactly the same time intervals for clock, user and system time and have the same running status.

Parameters:
stop_watch the stop watch to compare with
Returns:
bool true on equality, false otherwise
bool operator> ( const StopWatch stop_watch  )  const [inline]

Greater operator. Return true, if the stop watch is in all timings greater than the stop watch to be compared with (clock, user and system time).

Parameters:
stop_watch the stop watch to compare with
Returns:
bool true if all times are greater
bool operator>= ( const StopWatch stop_watch  )  const [inline]

Greater or equal operator. Return true, if the stop watch is in all timings greater or equal than the stop watch to be compared with (clock, user and system time).

Parameters:
stop_watch the stop watch to compare with
Returns:
bool true if all times are greater or equal
void reset (  ) 

Clear the stop watch without stopping. The stop watch is cleared, but not stopped (if running).

See also:
clear
bool start (  ) 

Start the stop watch. The stop watch is started. If the stop watch is already running, false is returned.

Returns:
bool false if the stop watch was already running, true otherwise

Referenced by main().

bool stop (  ) 

Stop the stop watch. The stop watch is stopped. If the stop watch was not running, false is returned.

Returns:
bool false if the was not running, true otherwise

Referenced by main().

static String toString ( DoubleReal  time  )  [static]

custom string formatting of time, using only the minimal number of units required (e.g., does not report hours when seconds suffice).


Member Data Documentation

PointerSizeInt cpu_speed_ [static, private]
PointerSizeInt current_secs_ [private]
PointerSizeInt current_usecs_ [private]
bool is_running_ [private]
PointerSizeInt start_secs_ [private]
PointerSizeInt start_usecs_ [private]

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:56 using doxygen 1.7.1