VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
makVrv::DtSampleAggregator Class Reference

The DtSampleAggregator allows users to collect up to a fixed number of rows of N columns of doubles. The number of columns and max number of rows are specified at construction, along with a dump filename. If the maximum number of rows is collected, the data is automatically dumped to the file and collection ends. User's can also request that current rows, whatever has been collected, is dumped (and collection stops). Finally, it is possible to 'zero out' the current data set and restart. If rowNumInOutput is true, the row number is included as the first output field. Fields are output in comma-separated rows.

Public Member Functions

 DtSampleAggregator (std::size_t numOfSamples, std::size_t numOfFields, const std::string &fileName, bool rowNumInOutput=true)
 
 ~DtSampleAggregator ()
 
std::size_t numSamples () const
 
std::size_t currentSample () const
 
std::size_t numFields () const
 
void addSample (std::size_t field, double sample)
 
void incrementSample ()
 
void reset ()
 
doublesamples (std::size_t field)
 
bool dumped (void) const
 
void dump ()
 
void addToDumpFile (const std::string &str)
 
bool valid () const
 

Static Public Member Functions

static std::size_t calculateNumberOfSamples (float estimatedFrequency, float estimatedRunTimeSeconds)
 

Protected Attributes

std::string myFileName
 
const std::size_t myNumSamples
 
const std::size_t myNumFields
 
std::size_t myCurrentSample
 
double ** myData
 
bool isValid
 
std::ofstream myDumpFile
 
bool myDumped
 
bool myRowNumInOutput
 

Private Member Functions

 DtSampleAggregator ()
 

Constructor & Destructor Documentation

makVrv::DtSampleAggregator::DtSampleAggregator ( std::size_t  numOfSamples,
std::size_t  numOfFields,
const std::string &  fileName,
bool  rowNumInOutput = true 
)

CTOR Max number of samples to be collected must be provided up front, so that mem allocations don't take up profiling time.

makVrv::DtSampleAggregator::~DtSampleAggregator ( )

DTOR.

makVrv::DtSampleAggregator::DtSampleAggregator ( )
private

Member Function Documentation

static std::size_t makVrv::DtSampleAggregator::calculateNumberOfSamples ( float  estimatedFrequency,
float  estimatedRunTimeSeconds 
)
static

Utility function: Given an approximate frequency and a run time in seconds will compute the upper bound on the number of samples needed.

std::size_t makVrv::DtSampleAggregator::numSamples ( ) const

Max number of samples that the profiler can profile.

std::size_t makVrv::DtSampleAggregator::currentSample ( ) const
std::size_t makVrv::DtSampleAggregator::numFields ( ) const

Number of arrays used to collect samples.

void makVrv::DtSampleAggregator::addSample ( std::size_t  field,
double  sample 
)

Add a sample value for the specified.

void makVrv::DtSampleAggregator::incrementSample ( )

Move onto the next sample.

void makVrv::DtSampleAggregator::reset ( )

discard current samples profiled (e.g. to start profiling anew)

double* makVrv::DtSampleAggregator::samples ( std::size_t  field)

Pointer to array of doubles for a field.

bool makVrv::DtSampleAggregator::dumped ( void  ) const

were stats dumped already? This can happen if the number of samples to be collected exceed the capacity

void makVrv::DtSampleAggregator::dump ( )

dump the collected samples to a file

void makVrv::DtSampleAggregator::addToDumpFile ( const std::string &  str)
bool makVrv::DtSampleAggregator::valid ( ) const

Is aggregator valid. Will be false if it cannot allocate memory for requested number of samples or if the dump file cannot be written to, etc.

Member Data Documentation

std::string makVrv::DtSampleAggregator::myFileName
protected
const std::size_t makVrv::DtSampleAggregator::myNumSamples
protected
const std::size_t makVrv::DtSampleAggregator::myNumFields
protected
std::size_t makVrv::DtSampleAggregator::myCurrentSample
protected
double** makVrv::DtSampleAggregator::myData
protected
bool makVrv::DtSampleAggregator::isValid
protected
std::ofstream makVrv::DtSampleAggregator::myDumpFile
protected
bool makVrv::DtSampleAggregator::myDumped
protected
bool makVrv::DtSampleAggregator::myRowNumInOutput
protected

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

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)