VHISTlib  1.84.0.3018
Public Member Functions
vhist::StopWatch Class Reference

A class to measure time intervals. More...

#include <stopwatch.h>

Inheritance diagram for vhist::StopWatch:
vhist::LogSource

List of all members.

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.

Detailed Description

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.

Examples:

stopwatch_example.cpp.


Constructor & Destructor Documentation

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.

Parameters:
[in]pLogTargetAn object which receives timing events via a slot.
See also:
vhist::LogSource::publishToLogSlot

Member Function Documentation

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.

Parameters:
[in]titleThe title of the new timing sequence.
[in]abortPreviouscontrols 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.

Parameters:
[in]generateMessageIf true, a log message is generated and will be published to all listeners. Otherwise, the timing results will be silently discarded

The documentation for this class was generated from the following files:

VHISTlib 1.84.0.3018 of Jun 28 2013, generated by doxygen.