Update BStopWatch documentation
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Documentation written by:
|
* Documentation written by:
|
||||||
* Niels Sascha Reedijk, [email protected]
|
* Niels Sascha Reedijk, [email protected]
|
||||||
|
* John Scipione, [email protected]
|
||||||
*
|
*
|
||||||
* Corresponds to:
|
* Corresponds to:
|
||||||
* headers/os/support/StopWatch.h rev 19972
|
* headers/os/support/StopWatch.h rev 19972
|
||||||
@@ -23,46 +24,53 @@
|
|||||||
\class BStopWatch
|
\class BStopWatch
|
||||||
\ingroup support
|
\ingroup support
|
||||||
\ingroup libbe
|
\ingroup libbe
|
||||||
\brief A timer class.
|
\brief A simple class used to time events like a stop watch.
|
||||||
|
|
||||||
This class provides method to time events. The interface is designed to
|
The interface of this class is designed to behave like a physical
|
||||||
behave like a physical stopwatch. It is especially useful for debugging
|
stop watch. It is useful for debugging parts of your code acting as a
|
||||||
certain parts of your code, since it can behave like a 'cheap' profiler.
|
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 \a silent parameter to \c true in the constructor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn BStopWatch::BStopWatch(const char *name, bool silent)
|
\fn BStopWatch::BStopWatch(const char *name, bool silent)
|
||||||
\brief Construct a BStopWatch object and starts the timer.
|
\brief Constructs a BStopWatch object and starts the timer.
|
||||||
|
|
||||||
The constructor creates a clean BStopWatch object. This object
|
This method creates a new BStopWatch object. As soon as the object is
|
||||||
can be given a name. As soon as the object is created, the time
|
created the timer starts ticking away.
|
||||||
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
|
If you are profiling your code with this class, pass \c true to the
|
||||||
\a silent parameter. Whenever the object is destroyed, information on
|
\a silent parameter. Doing so causes elapsed time information to be
|
||||||
the elapsed time will be streamed to standard output.
|
streamed to standard output when when the object is destroyed.
|
||||||
|
|
||||||
\param name The name you want to give this object. You may pass \c NULL.
|
\param name The name of the stop watch. You may pass \c NULL to create an
|
||||||
\param silent Pass \c true if you want to use this object as a simple
|
anonymous stop watch.
|
||||||
profiler.
|
\param silent Pass \c true to suppress time information from streaming to
|
||||||
|
standard output when the object is destroyed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn BStopWatch::~BStopWatch()
|
\fn BStopWatch::~BStopWatch()
|
||||||
\brief Destructor.
|
\brief Destroys the object stopping the timer.
|
||||||
|
|
||||||
Destroys the object. If the object was constructed with the parameter
|
If \a silent was set to \c false in the constructor then this method
|
||||||
silent set t to false, this destructor will print information on the elapsed
|
will print elapsed time information to standard output.
|
||||||
time to standard output.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void BStopWatch::Resume()
|
\fn void BStopWatch::Resume()
|
||||||
\brief Resume the timer when it is in a suspended state.
|
\brief Resume the timer from a suspended state.
|
||||||
|
|
||||||
\see Suspend()
|
\see Suspend()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -70,45 +78,51 @@
|
|||||||
/*!
|
/*!
|
||||||
\fn void BStopWatch::Suspend()
|
\fn void BStopWatch::Suspend()
|
||||||
\brief Suspend the timer.
|
\brief Suspend the timer.
|
||||||
|
|
||||||
\see Resume()
|
\see Resume()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bigtime_t BStopWatch::Lap()
|
\fn bigtime_t BStopWatch::Lap()
|
||||||
\brief Start a new lap.
|
\brief Starts a new timer lap.
|
||||||
|
|
||||||
This method sets a lap. With the current implementation you are unable to
|
In the current implementation you are unable to actually retrieve the
|
||||||
actually retrieve the timings of the laps. This is only printed to the
|
timings of each lap, they are only printed to the standard output when the
|
||||||
standard output when the object is destroyed. Thus making this tool only
|
object is destroyed. This makes the Lap() method only usable when doing
|
||||||
usuable for use when doing some profiling.
|
some types of profiling.
|
||||||
|
|
||||||
\attention Please note that the current implementation is limited to 10 laps.
|
\note The current implementation is limited to 10 laps. The value returned
|
||||||
The value returned is the time that has passed since the timer was started
|
is the time that has passed since the timer was last started (not
|
||||||
(and not the time that has passed since the last lap). Any lap call beyond
|
the time that has passed since the last lap). Any call to Lap()
|
||||||
the 10th lap will overwrite the last value. Note that if the timer is
|
beyond the 10th lap will overwrite the last value. Calling Lap()
|
||||||
suspended, nothing happens and the method will return 0.
|
while the timer is suspended does nothing and returns 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bigtime_t BStopWatch::ElapsedTime() const
|
\fn bigtime_t BStopWatch::ElapsedTime() const
|
||||||
\brief Get the elapsed time the object has counted.
|
\brief Gets the elapsed time the object has counted.
|
||||||
|
|
||||||
\return The elapsed time in microseconds.
|
\return The elapsed time in microseconds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void BStopWatch::Reset()
|
\fn void BStopWatch::Reset()
|
||||||
\brief Restart the timer.
|
\brief Restarts the timer.
|
||||||
|
|
||||||
Resets the object: it clears the start time, it clears the stored laps and it
|
Resets the stop watch clearing the start time and stored laps and
|
||||||
restarts the timer.
|
restarts the timer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn const char* BStopWatch::Name() const
|
\fn const char* BStopWatch::Name() const
|
||||||
\brief Get the name.
|
\brief Returns the name of the stop watch.
|
||||||
\return the name given to the object at creation time.
|
|
||||||
|
If name was set to \c NULL in the constructor this method returns a blank
|
||||||
|
string.
|
||||||
|
|
||||||
|
\return the name of the stop watch set in the constructor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user