Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

vpr::DurationStatCollector Class Reference

#include <DurationStatCollector.h>

Inheritance diagram for vpr::DurationStatCollector:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 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

Constructor & Destructor Documentation

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

Definition at line 54 of file DurationStatCollector.h.

References mStartTimeNeededNext, mUnits, vpr::SampleLimitedStatCollector< double, false >::SampleLimitedStatCollector, vpr::Interval::Sec, and vpr::Interval::Unit.

00055     : SampleLimitedStatCollector<double, false>(sampleLimit)
00056    {
00057       mUnits = units;
00058       mStartTimeNeededNext = true;
00059    }


Member Function Documentation

void vpr::DurationStatCollector::startSample   [inline]
 

Definition at line 61 of file DurationStatCollector.h.

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

00062    {
00063       vprASSERT(mStartTimeNeededNext);
00064       mStartTimeNeededNext = false;
00065 
00066       mSampleStartTime.setNow();
00067       //std::cout << "sta: " << mSampleStartTime.usec() << "\n";
00068    }

void vpr::DurationStatCollector::stopSample   [inline]
 

Definition at line 70 of file DurationStatCollector.h.

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

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


Member Data Documentation

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

Definition at line 103 of file DurationStatCollector.h.

Referenced by DurationStatCollector.

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

Definition at line 105 of file DurationStatCollector.h.

Referenced by startSample, and stopSample.

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

Definition at line 106 of file DurationStatCollector.h.

Referenced by stopSample.

bool vpr::DurationStatCollector::mStartTimeNeededNext [protected]
 

Definition at line 108 of file DurationStatCollector.h.

Referenced by DurationStatCollector, startSample, and stopSample.


The documentation for this class was generated from the following file:
Generated on Sun May 2 14:47:16 2004 for VR Juggler Portable Runtime by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002