VR-Forces 4.7 Class Documentation
 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. More...

Public Member Functions

 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.
 ~DtSampleAggregator ()
 DTOR.
std::size_t numSamples () const
 Max number of samples that the profiler can profile.
std::size_t currentSample () const
std::size_t numFields () const
 Number of arrays used to collect samples.
void addSample (std::size_t field, double sample)
 Add a sample value for the specified.
void incrementSample ()
 Move onto the next sample.
void reset ()
 discard current samples profiled (e.g. to start profiling anew)
doublesamples (std::size_t field)
 Pointer to array of doubles for a field.
bool dumped (void) const
 were stats dumped already? This can happen if the number of samples to be collected exceed the capacity
void dump ()
 dump the collected samples to a file
void addToDumpFile (const std::string &str)
bool valid () const
 Is aggregator valid.

Static Public Member Functions

static std::size_t calculateNumberOfSamples (float estimatedFrequency, float estimatedRunTimeSeconds)
 Utility function: Given an approximate frequency and a run time in seconds will compute the upper bound on the number of samples needed.

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 ()

Detailed Description

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.

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 Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)