tsid 1.9.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
Loading...
Searching...
No Matches
Statistics Class Reference

A class to compute statistics about quantities of interest. More...

#include <tsid/utils/statistics.hpp>

Classes

struct  QuantityData

Public Member Functions

 Statistics ()
 ~Statistics ()
bool quantity_exists (std::string name)
void store (std::string name, const double &value)
void reset (std::string name)
void reset_all ()
void report (std::string name, int precision=2, std::ostream &output=std::cout)
void report_all (int precision=2, std::ostream &output=std::cout)
long double get_total (std::string name)
long double get_average (std::string name)
long double get_min (std::string name)
long double get_max (std::string name)
long double get_last (std::string name)
void turn_off ()
void turn_on ()

Protected Attributes

bool active
std::map< std::string, QuantityData > * records_of

Detailed Description

A class to compute statistics about quantities of interest.

Statistics stat();
Statistics()
Definition statistics.cpp:17

The Statistics class can be used to keep track of the minimum, maximum, average of quantities of interest.

To report the results just call:

stat.report("Code ID");

Thou can also provide an additional std::ostream& parameter to report() to redirect the logging on a different output. Also, you can use the get_total/min/max/average() methods to get the individual numeric data, without all the details of the logging. You can also extend Statistics to implement your own logging syntax.

To report all the measurements:

stat.report_all();

Same as above, you can redirect the output by providing a std::ostream& parameter.

Constructor & Destructor Documentation

◆ Statistics()

Statistics::Statistics()

Constructor

◆ ~Statistics()

Statistics::~Statistics()

Destructor

Member Function Documentation

◆ get_average()

long double Statistics::get_average(std::stringname)

Returns average execution of a certain quantity

◆ get_last()

long double Statistics::get_last(std::stringname)

Return last measurement of a certain quantity

◆ get_max()

long double Statistics::get_max(std::stringname)

Returns maximum execution of a certain quantity

◆ get_min()

long double Statistics::get_min(std::stringname)

Returns minimum execution of a certain quantity

◆ get_total()

long double Statistics::get_total(std::stringname)

Returns total execution of a certain quantity

◆ quantity_exists()

bool Statistics::quantity_exists(std::stringname)

Tells if a quantity with a certain name exists

◆ report()

void Statistics::report(std::stringname,
intprecision = 2,
std::ostream &output = std::cout )

Dump the data of a certain quantity record

◆ report_all()

void Statistics::report_all(intprecision = 2,
std::ostream &output = std::cout )

Dump the data of all the quantity records

◆ reset()

void Statistics::reset(std::stringname)

Reset a certain quantity record

◆ reset_all()

void Statistics::reset_all()

Resets all the quantity records

◆ store()

void Statistics::store(std::stringname,
const double &value )

Record the value of the specified quantity

◆ turn_off()

void Statistics::turn_off()

Turn off statistics, all the Statistics::* methods return without doing anything after this method is called.

◆ turn_on()

void Statistics::turn_on()

Turn on statistics, restore operativity after a turn_off().

Member Data Documentation

◆ active

bool Statistics::active
protected

Flag to hold the statistics status

◆ records_of

std::map<std::string, QuantityData>* Statistics::records_of
protected

Pointer to the dynamic structure which holds the collection of quantity data


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