supereight
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PerfStats Struct Reference

#include <perfstats.hpp>

Classes

struct  Results
 
struct  Stats
 

Public Types

enum  Type {
  BOOL, COORDINATES, COUNT, CURRENT,
  DISTANCE, DOUBLE, DURATION, ENERGY,
  FRAME, FREQUENCY, INT, ITERATION,
  MEMORY, ORIENTATION, PERCENTAGE, POSITION,
  POWER, TIME, UNDEFINED, VOLTAGE
}
 

Public Member Functions

 PerfStats ()
 
 PerfStats (const bool include_detailed)
 
std::string createHeaderString ()
 
std::string createDataIterString ()
 
std::string createDataIterString (const size_t iter)
 
std::string createDataString ()
 
void debug ()
 
const Statsget (const std::string &key) const
 
std::vector< double > getLastData (const std::string &key)
 
double getLastDataMerged (const std::string &key)
 
double getSampleTime (const std::string &key)
 
Type getType (const std::string &key)
 
void reset ()
 
void reset (const std::string &key)
 
double sample (const std::string &key, const double value, const Type type=COUNT, const bool detailed=false)
 
double sampleT_WB (const Eigen::Matrix4f &T_WB, const bool detailed=false)
 
double sampleDurationStart (const std::string &key, const bool detailed=false)
 
double sampleDurationEnd (const std::string &key)
 
void setFilestream (std::ofstream *filestream)
 
void includeDetailed (const bool include_detailed)
 Set flag to include detailed stats to std::string output. More...
 
void setIter (const size_t iter)
 Set the current iteration and add it to the stats. More...
 
void writeToFilestream ()
 Write performance stats to filestream. More...
 
void writeToOStream (std::ostream &ostream)
 
void writeSummaryToOStream (std::ostream &ostream, const bool include_iter_data=true)
 

Static Public Member Functions

static double getTime ()
 

Public Attributes

std::vector< PerfStats::Typeheader_order_
 The order the different types are added to the output. More...
 
bool include_detailed_
 Flag to add stats marked as detailed to the output. More...
 
int insertion_idx_
 The index of the next stat to be inserted to performance stats. More...
 
size_t iter_
 The current iteration. More...
 
std::map< int, std::string > order_
 The order the stats are added to the stats_ map | map idx -> stat name. More...
 
std::map< std::string, Statsstats_
 The map stat name -> stat. More...
 
std::ofstream * filestream_
 IO function. More...
 
bool filestream_aligned_
 
size_t filestream_last_iter_
 
std::streampos filestream_pos_
 
bool ostream_aligned_
 
size_t ostream_last_iter_
 

Member Enumeration Documentation

◆ Type

Enumerator
BOOL 
COORDINATES 
COUNT 
CURRENT 
DISTANCE 
DOUBLE 
DURATION 
ENERGY 
FRAME 
FREQUENCY 
INT 
ITERATION 
MEMORY 
ORIENTATION 
PERCENTAGE 
POSITION 
POWER 
TIME 
UNDEFINED 
VOLTAGE 

Constructor & Destructor Documentation

◆ PerfStats() [1/2]

PerfStats::PerfStats ( )

◆ PerfStats() [2/2]

PerfStats::PerfStats ( const bool  include_detailed)

Member Function Documentation

◆ createHeaderString()

std::string PerfStats::createHeaderString ( )
Returns
The tab separated stats names with units.

◆ createDataIterString() [1/2]

std::string PerfStats::createDataIterString ( )
Returns

◆ createDataIterString() [2/2]

std::string PerfStats::createDataIterString ( const size_t  iter)
Parameters
[in]iter
Returns

◆ createDataString()

std::string PerfStats::createDataString ( )
Returns

◆ debug()

void PerfStats::debug ( )
Returns

◆ get()

const Stats& PerfStats::get ( const std::string &  key) const
inline
Parameters
[in]keyThe key to the requested stats.
Returns
The stats cooresponding

◆ getLastData()

std::vector<double> PerfStats::getLastData ( const std::string &  key)
Parameters
[in]key
Returns

◆ getLastDataMerged()

double PerfStats::getLastDataMerged ( const std::string &  key)
Parameters
[in]

◆ getSampleTime()

double PerfStats::getSampleTime ( const std::string &  key)
Parameters
[in]

◆ getTime()

static double PerfStats::getTime ( )
static
Returns

◆ getType()

Type PerfStats::getType ( const std::string &  key)
Parameters
[in]

◆ reset() [1/2]

void PerfStats::reset ( )
Returns

◆ reset() [2/2]

void PerfStats::reset ( const std::string &  key)
Parameters
[in]

◆ sample()

double PerfStats::sample ( const std::string &  key,
const double  value,
const Type  type = COUNT,
const bool  detailed = false 
)
Parameters
[in]key
[in]value
[in]type
[in]detailed
Returns

◆ sampleT_WB()

double PerfStats::sampleT_WB ( const Eigen::Matrix4f &  T_WB,
const bool  detailed = false 
)

◆ sampleDurationStart()

double PerfStats::sampleDurationStart ( const std::string &  key,
const bool  detailed = false 
)
Parameters
[in]key
[in]detailed
Returns

◆ sampleDurationEnd()

double PerfStats::sampleDurationEnd ( const std::string &  key)
Parameters
[in]key
Returns

◆ setFilestream()

void PerfStats::setFilestream ( std::ofstream *  filestream)
Parameters
[in]stats_stream

◆ includeDetailed()

void PerfStats::includeDetailed ( const bool  include_detailed)
inline

Set flag to include detailed stats to std::string output.

Parameters
[in]include_detailed

◆ setIter()

void PerfStats::setIter ( const size_t  iter)
inline

Set the current iteration and add it to the stats.

Parameters
[in]iter

◆ writeToFilestream()

void PerfStats::writeToFilestream ( )

Write performance stats to filestream.

The first time the function is called the header will be added. If the

◆ writeToOStream()

void PerfStats::writeToOStream ( std::ostream &  ostream)
Parameters
[in]ostream

◆ writeSummaryToOStream()

void PerfStats::writeSummaryToOStream ( std::ostream &  ostream,
const bool  include_iter_data = true 
)
Parameters
[in]ostream
[in]include_iter_data

Member Data Documentation

◆ header_order_

std::vector<PerfStats::Type> PerfStats::header_order_
Initial value:

The order the different types are added to the output.

◆ include_detailed_

bool PerfStats::include_detailed_

Flag to add stats marked as detailed to the output.

◆ insertion_idx_

int PerfStats::insertion_idx_

The index of the next stat to be inserted to performance stats.

◆ iter_

size_t PerfStats::iter_

The current iteration.

◆ order_

std::map<int, std::string> PerfStats::order_

The order the stats are added to the stats_ map | map idx -> stat name.

◆ stats_

std::map<std::string, Stats> PerfStats::stats_

The map stat name -> stat.

◆ filestream_

std::ofstream* PerfStats::filestream_

IO function.

◆ filestream_aligned_

bool PerfStats::filestream_aligned_

◆ filestream_last_iter_

size_t PerfStats::filestream_last_iter_

◆ filestream_pos_

std::streampos PerfStats::filestream_pos_

◆ ostream_aligned_

bool PerfStats::ostream_aligned_

◆ ostream_last_iter_

size_t PerfStats::ostream_last_iter_

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