org::xmlBlaster::util::StopWatch Class Reference

Measure the elapsed time. More...

List of all members.

Public Member Functions

 StopWatch (long stopTime=-1)
 ~StopWatch ()
long elapsed ()
 Return the elapsed milliseconds since creation or since the last restart().
std::string nice ()
 Returns a nice std::string with elapsed time.
std::string toString ()
 Nicely formatted output containing elapsed time since Construction or since last restart().
void restart (long stopTime=-1)
 Reset and start the stop watch for a new measurement cycle.
bool isRunning ()
 returns true if the stopwatch is still running, false if it has stopped (i.e.
void wait (long millisec)
 Waits for the amount of milliseconds specified in millisec and then returns.


Detailed Description

Measure the elapsed time.

Use this helper class if you want to measure elapsed time in some code fragment. If you specify (a positive) time in the argument list, it is the time in milliseconds which the stop watch should wait.

Is not implemented for Windows CE

Definition at line 29 of file StopWatch.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::StopWatch::StopWatch ( long  stopTime = -1  ) 

Definition at line 39 of file StopWatch.h.

org::xmlBlaster::util::StopWatch::~StopWatch (  ) 

Definition at line 49 of file StopWatch.h.


Member Function Documentation

long org::xmlBlaster::util::StopWatch::elapsed (  ) 

Return the elapsed milliseconds since creation or since the last restart().

Returns:
elapsed Milliseconds since creation or restart()

Definition at line 63 of file StopWatch.h.

Referenced by org::xmlBlaster::test::TestRam::testPublish().

std::string org::xmlBlaster::util::StopWatch::nice (  ) 

Returns a nice std::string with elapsed time.

Resets the stop watch.

Returns:
The elapsed time in a nice formatted std::string

Definition at line 82 of file StopWatch.h.

std::string org::xmlBlaster::util::StopWatch::toString (  ) 

Nicely formatted output containing elapsed time since Construction or since last restart().

Returns:
The elapsed time in a nice formatted std::string

Definition at line 95 of file StopWatch.h.

References org::xmlBlaster::util::lexical_cast().

void org::xmlBlaster::util::StopWatch::restart ( long  stopTime = -1  ) 

Reset and start the stop watch for a new measurement cycle.

Definition at line 104 of file StopWatch.h.

Referenced by org::xmlBlaster::test::TestRam::testPublish().

bool org::xmlBlaster::util::StopWatch::isRunning (  ) 

returns true if the stopwatch is still running, false if it has stopped (i.e.

when the time specified in the constructor of in the restart method has elapsed). If no stop time was given (nothing was passed to the constructor or restart), then it always returns true.

Definition at line 118 of file StopWatch.h.

void org::xmlBlaster::util::StopWatch::wait ( long  millisec  ) 

Waits for the amount of milliseconds specified in millisec and then returns.

Definition at line 128 of file StopWatch.h.

Referenced by org::xmlBlaster::TestLogin::testLoginLogout().


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