version 1.17, 2005/02/05 22:59:24
|
version 1.18, 2005/03/07 16:06:12
|
|
|
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: | // Modified By: |
|
// Chip Vincent (cvincent@us.ibm.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#define Pegasus_Stopwatch_h | #define Pegasus_Stopwatch_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/TimeValue.h> |
|
#include <Pegasus/Common/System.h> |
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
*/ | */ |
class PEGASUS_COMMON_LINKAGE Stopwatch | class PEGASUS_COMMON_LINKAGE Stopwatch |
{ | { |
private: |
|
TimeValue _start; |
|
|
|
public: | public: |
| |
/** stopwatch constructor. The constructor creates the object and |
/** constructor. The constructor creates the object. Start |
starts the timer |
must be called to start the timer. |
@example Stopwatch time; | @example Stopwatch time; |
*/ | */ |
Stopwatch(); |
Stopwatch(void); |
| |
/** Reset Stopwatch resets an existing Stopwatch object to the |
/** start - Starts accumulating time and continues until stop is called. |
current time value |
The object can be started and stopped multiple times to measure the |
|
sum of several intervals, but each start must have a corresponding start. |
*/ | */ |
void reset(); |
void start(void); |
| |
/** getElapsed - Get the elapsed time for the defined stopwatch. |
/** stop - Stops the accumlation of time for an interval. The object |
|
should only stopped if it has been started. |
|
*/ |
|
void stop(void); |
|
|
|
/** reset - Effectively clears the time values stored by a Stopwatch. |
|
*/ |
|
void reset(void); |
|
|
|
/** getElapsed - Get the elapsed time for the defined stopwatch. This |
|
method should only be called if it is currently stopped. |
@return Returns the elapsed time value as a double | @return Returns the elapsed time value as a double |
*/ | */ |
double getElapsed() const; |
double getElapsed(void) const; |
| |
/** printElapsed method gets the current value of the timer and | /** printElapsed method gets the current value of the timer and |
sends it to standardout as a string with the word seconds attached | sends it to standardout as a string with the word seconds attached |
*/ | */ |
void printElapsed(); |
void printElapsed(void); |
|
|
|
private: |
|
Uint32 _start; |
|
Uint32 _stop; |
|
|
|
double _total; |
|
|
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |