VHISTlib
1.84.0.3018
|
A class to measure time intervals. More...
#include <stopwatch.h>
Public Member Functions | |
StopWatch (QObject *pLogTarget=NULL) | |
Creates a new StopWatch object and adds pLogTarget as a listener. | |
virtual | ~StopWatch () |
Destroys the StopWatch object. | |
void | start (const QString &title, bool abortPrevious=false) |
Starts a new timing sequence. | |
void | stop (bool generateMessage=true) |
Stops the currently running timing sequence. |
A class to measure time intervals.
This class measures the time between two consecutive calls to the StopWatch::start and StopWatch::stop methods. The results will be published using the interface provided by the vhist::LogSource class.
StopWatch::StopWatch | ( | QObject * | pLogTarget = NULL | ) |
Creates a new StopWatch object and adds pLogTarget as a listener.
The listener will receive all timing results generated by this object.
[in] | pLogTarget | An object which receives timing events via a slot. |
void StopWatch::start | ( | const QString & | title, |
bool | abortPrevious = false |
||
) |
Starts a new timing sequence.
The StopWatch will count the time elapsed till the next call to stop(). If another timing sequence is already running, it will be stopped before starting the new one. It's results will be published to all listeners of the StopWatch unless abortPrevious is set to true
in which case no results are published.
[in] | title | The title of the new timing sequence. |
[in] | abortPrevious | controls whether the currently running timing sequence should be aborted or stopped and results published. |
void StopWatch::stop | ( | bool | generateMessage = true | ) |
Stops the currently running timing sequence.
If no sequence is running, calling this function is a NoOp.
[in] | generateMessage | If true , a log message is generated and will be published to all listeners. Otherwise, the timing results will be silently discarded |