/** Copyright 2007-2014 Haiku, Inc. All rights reserved.* Distributed under the terms of the MIT License.** Documentation written by:* Niels Sascha Reedijk, niels.reedijk@gmail.com* John Scipione, jscipione@gmail.com** Corresponds to:* headers/os/support/StopWatch.h rev 19972* src/kits/support/StopWatch.cpp rev 14204*//*!\file StopWatch.h\ingroup support\ingroup libbe\brief Provides the BStopWatch class.*//*!\class BStopWatch\ingroup support\ingroup libbe\brief A simple class used to time events like a stop watch.The interface of this class is designed to behave like a physicalstop watch. It is useful for debugging parts of your code acting as aquick and dirty profiler.To use this class first create a BStopWatch object, this starts the timergoing. You may call Suspend() and Resume() to start and stop the stopwatch. Call ElapsedTime() to get the current timer count at any time. Youmay call Lap() to start a new lap (up to 10 laps are supported) or callReset() to reset the timer back to 0 clearing all lap info. When theobject is destroyed the timing information is streamed to standard outunless you set the \a silent parameter to \c true in the constructor.\since BeOS R3*//*!\fn BStopWatch::BStopWatch(const char* name, bool silent)\brief Constructs a BStopWatch object and starts the timer.This method creates a new BStopWatch object. As soon as the object iscreated the timer starts ticking away.If you are profiling your code with this class pass \c false to the\a silent parameter to cause the elapsed time information to bestreamed to standard output when the object is destroyed.\param name The name of the stop watch. You may pass \c NULL to create ananonymous stop watch.\param silent Pass \c true to suppress time information from streaming tostandard output when the object is destroyed.\since BeOS R3*//*!\fn BStopWatch::~BStopWatch()\brief Destroys the object stopping the timer.If \a silent was set to \c false in the constructor then this methodwill print elapsed time information to standard output.\since BeOS R3*//*!\fn void BStopWatch::Resume()\brief Resume the timer from a suspended state.\see Suspend()\since BeOS R3*//*!\fn void BStopWatch::Suspend()\brief Suspend the timer.\see Resume()\since BeOS R3*//*!\fn bigtime_t BStopWatch::Lap()\brief Starts a new timer lap.In the current implementation you are unable to actually retrieve thetimings of each lap, they are only printed to the standard output when theobject is destroyed. This makes the Lap() method only usable when doingsome types of profiling.\note The current implementation is limited to 10 laps. The value returnedis the time that has passed since the timer was last started (notthe time that has passed since the last lap). Any call to Lap()beyond the 10th lap will overwrite the last value. Calling Lap()while the timer is suspended does nothing and returns 0.\since BeOS R3*//*!\fn bigtime_t BStopWatch::ElapsedTime() const\brief Gets the elapsed time the object has counted.\return The elapsed time in microseconds.\since BeOS R3*//*!\fn void BStopWatch::Reset()\brief Restarts the timer.Resets the stop watch clearing the start time and stored laps andrestarts the timer.\since BeOS R3*//*!\fn const char* BStopWatch::Name() const\brief Returns the name of the stop watch.If name was set to \c NULL in the constructor this method returns a blankstring.\return the name of the stop watch set in the constructor.\since BeOS R3*/