Public Member Functions | |
| BStopWatch (const char *name, bool silent=false) | |
| Construct a BStopWatch object and starts the timer. | |
| bigtime_t | ElapsedTime () const |
| Get the elapsed time the object has counted. | |
| bigtime_t | Lap () |
| Start a new lap. | |
| const char * | Name () const |
| Get the name. | |
| void | Reset () |
| Restart the timer. | |
| void | Resume () |
| Resume the timer when it is in a suspended state. | |
| void | Suspend () |
| Suspend the timer. | |
| virtual | ~BStopWatch () |
| Destructor. | |
This class provides method to time events. The interface is designed to behave like a physical stopwatch. It is especially useful for debugging certain parts of your code, since it can behave like a 'cheap' profiler.
| BStopWatch::BStopWatch | ( | const char * | name, | |
| bool | silent = false | |||
| ) |
Construct a BStopWatch object and starts the timer.
The constructor creates a clean BStopWatch object. This object can be given a name. As soon as the object is created, the time will start ticking away. This class is designed to be usuable as a primitive profiling tool.
If you are profiling your code with this class, pass true as the silentparameter. Whenever the object is destroyed, information on the elapsed time will be streamed to standard output.
| name | The name you want to give this object. You may pass NULL. | |
| silent | Pass true if you want to use this object as a simple profiler. |
| BStopWatch::~BStopWatch | ( | ) | [virtual] |
Destructor.
Destroys the object. If the object was constructed with the parameter silent set t to false, this destructor will print information on the elapsed time to standard output.
| bigtime_t BStopWatch::ElapsedTime | ( | ) | const |
Get the elapsed time the object has counted.
| bigtime_t BStopWatch::Lap | ( | ) |
Start a new lap.
This method sets a lap. With the current implementation you are unable to actually retrieve the timings of the laps. This is only printed to the standard output when the object is destroyed. Thus making this tool only usuable for use when doing some profiling.
| const char * BStopWatch::Name | ( | ) | const |
Get the name.
| void BStopWatch::Reset | ( | ) |
Restart the timer.
Resets the object: it clears the start time, it clears the stored laps and it restarts the timer.
| void BStopWatch::Resume | ( | ) |
| void BStopWatch::Suspend | ( | ) |