vpr::DurationStatCollector Class Reference

Duration statistics collector class. More...

#include <vpr/Util/DurationStatCollector.h>

Inheritance diagram for vpr::DurationStatCollector:

Inheritance graph
[legend]
Collaboration diagram for vpr::DurationStatCollector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DurationStatCollector (vpr::Interval::Unit units=vpr::Interval::Sec, unsigned sampleLimit=100)
void startSample ()
void stopSample ()

Protected Attributes

vpr::Interval::Unit mUnits
vpr::Interval mSampleStartTime
vpr::Interval mSampleStopTime
bool mStartTimeNeededNext

Detailed Description

Duration statistics collector class.

Definition at line 55 of file DurationStatCollector.h.


Constructor & Destructor Documentation

vpr::DurationStatCollector::DurationStatCollector ( vpr::Interval::Unit  units = vpr::Interval::Sec,
unsigned  sampleLimit = 100 
) [inline]

Definition at line 58 of file DurationStatCollector.h.

00060       : SampleLimitedStatCollector<double, false>(sampleLimit)
00061       , mUnits(units)
00062       , mStartTimeNeededNext(true)
00063    {
00064       ;
00065    }


Member Function Documentation

void vpr::DurationStatCollector::startSample (  )  [inline]

Definition at line 67 of file DurationStatCollector.h.

References mSampleStartTime, mStartTimeNeededNext, vpr::Interval::setNow(), and vprASSERT.

00068    {
00069       vprASSERT(mStartTimeNeededNext);
00070       mStartTimeNeededNext = false;
00071 
00072       mSampleStartTime.setNow();
00073       //std::cout << "sta: " << mSampleStartTime.usec() << "\n";
00074    }

void vpr::DurationStatCollector::stopSample (  )  [inline]

Definition at line 76 of file DurationStatCollector.h.

References vpr::SampleLimitedStatCollector< double, false >::addSample(), mSampleStartTime, mSampleStopTime, vpr::Interval::Msec, vpr::Interval::msecf(), mStartTimeNeededNext, mUnits, vpr::Interval::Sec, vpr::Interval::secf(), vpr::Interval::setNow(), vpr::Interval::Usec, vpr::Interval::usecf(), and vprASSERT.

00077    {
00078       vprASSERT(!mStartTimeNeededNext);
00079       mStartTimeNeededNext = true;
00080 
00081       // Compute time difference
00082       mSampleStopTime.setNow();
00083       //std::cout << "sto: " << mSampleStopTime.usec() << "\n";
00084       vpr::Interval diff(mSampleStopTime - mSampleStartTime);
00085       //std::cout << "d: " << diff.usec() << "\n";
00086       double sample(0.0f);
00087 
00088       switch(mUnits)
00089       {
00090       case vpr::Interval::Sec:
00091          sample = diff.secf();
00092          break;
00093       case vpr::Interval::Msec:
00094          sample = diff.msecf();
00095          break;
00096       case vpr::Interval::Usec:
00097          sample = diff.usecf();
00098          break;
00099       default:
00100          vprASSERT(false && "Invalid units");
00101          break;
00102       }
00103 
00104       //std::cout << "s: " << sample << "\n";
00105       addSample(sample);
00106    }


Member Data Documentation

vpr::Interval::Unit vpr::DurationStatCollector::mUnits [protected]

Definition at line 109 of file DurationStatCollector.h.

Referenced by stopSample().

vpr::Interval vpr::DurationStatCollector::mSampleStartTime [protected]

Definition at line 111 of file DurationStatCollector.h.

Referenced by startSample(), and stopSample().

vpr::Interval vpr::DurationStatCollector::mSampleStopTime [protected]

Definition at line 112 of file DurationStatCollector.h.

Referenced by stopSample().

bool vpr::DurationStatCollector::mStartTimeNeededNext [protected]

Definition at line 114 of file DurationStatCollector.h.

Referenced by startSample(), and stopSample().


The documentation for this class was generated from the following file:
Generated on Thu Jan 4 10:56:04 2007 for VR Juggler Portable Runtime by  doxygen 1.5.1