# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CStopWatch Class Reference

Stopwatch class used for performance measurements and statistics. More...

#include <stop_watch.h>

List of all members.

Public Methods

 CStopWatch (uint queueLength=0)
 Constructor. Set a non-zero queueLength for partial average calculation. More...

void start ()
 Begin measurement. More...

void pause ()
 Pause. More...

void resume ()
 Resume. More...

void addTime (TTickDuration t)
 Add time (in ticks unit) to the current measurement. More...

void stop ()
 End measurement. More...

void addMeasurement (TTickDuration t)
 Add an external duration (in ticks unit) to the average queue. More...

TMsDuration getDuration () const
 Elapsed time in millisecond (call it after stop()). More...

TMsDuration getPartialAverage () const
 Average duration of the queueLength last durations (using the queueLength argument specified in the constructor). More...

TMsDuration getAverageDuration () const
 Average of the duration. More...

TTickDuration sumTicks () const
 Sum of the measured durations (in ticks). More...

uint32 measurementNumber () const
 Number of measurements. More...


Private Attributes

TTicks _BeginTime
TTickDuration _ElapsedTicks
TTickDuration _SumTicks
uint32 _MeasurementNumber
std::deque< TTickDuration_Queue
uint _QLength


Detailed Description

Stopwatch class used for performance measurements and statistics.

To measure the duration of a cycle, call stop(), get the results, then call start().

Author:
Olivier Cado , Nevrax France
Date:
2001

Definition at line 48 of file stop_watch.h.


Constructor & Destructor Documentation

NLMISC::CStopWatch::CStopWatch uint    queueLength = 0
 

Constructor. Set a non-zero queueLength for partial average calculation.

Definition at line 39 of file stop_watch.cpp.


Member Function Documentation

void NLMISC::CStopWatch::addMeasurement TTickDuration    t
 

Add an external duration (in ticks unit) to the average queue.

Definition at line 112 of file stop_watch.cpp.

References _MeasurementNumber, _QLength, _Queue, _SumTicks, t, and NLMISC::TTickDuration.

void NLMISC::CStopWatch::addTime TTickDuration    t
 

Add time (in ticks unit) to the current measurement.

Definition at line 80 of file stop_watch.cpp.

References _ElapsedTicks, t, and NLMISC::TTickDuration.

TMsDuration NLMISC::CStopWatch::getAverageDuration   const
 

Average of the duration.

Definition at line 155 of file stop_watch.cpp.

References _MeasurementNumber, _SumTicks, and NLMISC::TMsDuration.

TMsDuration NLMISC::CStopWatch::getDuration   const
 

Elapsed time in millisecond (call it after stop()).

Definition at line 134 of file stop_watch.cpp.

References _ElapsedTicks, and NLMISC::TMsDuration.

TMsDuration NLMISC::CStopWatch::getPartialAverage   const
 

Average duration of the queueLength last durations (using the queueLength argument specified in the constructor).

Definition at line 143 of file stop_watch.cpp.

References _Queue, and NLMISC::TMsDuration.

uint32 NLMISC::CStopWatch::measurementNumber   const [inline]
 

Number of measurements.

Definition at line 92 of file stop_watch.h.

References _MeasurementNumber.

void NLMISC::CStopWatch::pause  
 

Pause.

Definition at line 62 of file stop_watch.cpp.

References _BeginTime, and _ElapsedTicks.

void NLMISC::CStopWatch::resume  
 

Resume.

Definition at line 71 of file stop_watch.cpp.

References _BeginTime.

void NLMISC::CStopWatch::start  
 

Begin measurement.

Definition at line 52 of file stop_watch.cpp.

References _BeginTime, and _ElapsedTicks.

void NLMISC::CStopWatch::stop  
 

End measurement.

Definition at line 89 of file stop_watch.cpp.

References _BeginTime, _ElapsedTicks, _MeasurementNumber, _QLength, _Queue, and _SumTicks.

TTickDuration NLMISC::CStopWatch::sumTicks   const [inline]
 

Sum of the measured durations (in ticks).

Definition at line 89 of file stop_watch.h.

References _SumTicks, and NLMISC::TTickDuration.


Member Data Documentation

TTicks NLMISC::CStopWatch::_BeginTime [private]
 

Definition at line 96 of file stop_watch.h.

Referenced by pause, resume, start, and stop.

TTickDuration NLMISC::CStopWatch::_ElapsedTicks [private]
 

Definition at line 97 of file stop_watch.h.

Referenced by addTime, getDuration, pause, start, and stop.

uint32 NLMISC::CStopWatch::_MeasurementNumber [private]
 

Definition at line 100 of file stop_watch.h.

Referenced by addMeasurement, getAverageDuration, measurementNumber, and stop.

uint NLMISC::CStopWatch::_QLength [private]
 

Definition at line 103 of file stop_watch.h.

Referenced by addMeasurement, and stop.

std::deque<TTickDuration> NLMISC::CStopWatch::_Queue [private]
 

Definition at line 102 of file stop_watch.h.

Referenced by addMeasurement, getPartialAverage, and stop.

TTickDuration NLMISC::CStopWatch::_SumTicks [private]
 

Definition at line 99 of file stop_watch.h.

Referenced by addMeasurement, getAverageDuration, stop, and sumTicks.


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