A simple class used to time events like a stop watch. More...
|BStopWatch (const char *name, bool silent=false)|
|Constructs a BStopWatch object and starts the timer. |
|Destroys the object stopping the timer. |
|bigtime_t||ElapsedTime () const|
|Gets the elapsed time the object has counted. |
|Starts a new timer lap. |
|const char *||Name () const|
|Returns the name of the stop watch. |
|Restarts the timer. |
|Resume the timer from a suspended state. |
|Suspend the timer. |
A simple class used to time events like a stop watch.
The interface of this class is designed to behave like a physical stop watch. It is useful for debugging parts of your code acting as a quick and dirty profiler.
To use this class first create a BStopWatch object, this starts the timer going. You may call Suspend() and Resume() to start and stop the stop watch. Call ElapsedTime() to get the current timer count at any time. You may call Lap() to start a new lap (up to 10 laps are supported) or call Reset() to reset the timer back to 0 clearing all lap info. When the object is destroyed the timing information is streamed to standard out unless you set the silent parameter to
true in the constructor.
|BStopWatch::BStopWatch||(||const char *||name,|
Constructs a BStopWatch object and starts the timer.
This method creates a new BStopWatch object. As soon as the object is created the timer starts ticking away.
If you are profiling your code with this class pass
false to the silent parameter to cause the elapsed time information to be streamed to standard output when the object is destroyed.
|name||The name of the stop watch. You may pass |
Destroys the object stopping the timer.
If silent was set to
false in the constructor then this method will print elapsed time information to standard output.
Gets the elapsed time the object has counted.
Starts a new timer lap.
In the current implementation you are unable to actually retrieve the timings of each lap, they are only printed to the standard output when the object is destroyed. This makes the Lap() method only usable when doing some types of profiling.
|const char * BStopWatch::Name||(||)||const|
Returns the name of the stop watch.
If name was set to
NULL in the constructor this method returns a blank string.
Restarts the timer.
Resets the stop watch clearing the start time and stored laps and restarts the timer.
Resume the timer from a suspended state.
Suspend the timer.