11#ifndef SE_PERFSTATS_HPP
12#define SE_PERFSTATS_HPP
14#include <Eigen/Geometry>
220 std::map<size_t, std::vector<double>>
data_;
302 std::map<int, std::string>
319#include "impl/perfstats_impl.hpp"
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
Definition perfstats.hpp:226
double min
Definition perfstats.hpp:228
double max
Definition perfstats.hpp:229
double sum
Definition perfstats.hpp:230
double mean
Definition perfstats.hpp:227
Definition perfstats.hpp:54
double mergeIter(const size_t iter)
Merge the stats data a given interation into a scalar value.
double last() const
Provide the last stored value to the stats data.
static double sumIter(const std::vector< double > &iter_data_vec)
Compute the sum of the values of the stats data of an iteration.
double merge() const
Merge all stats data into a scalar value.
Type type_
The type of data stored in the stat struct.
Definition perfstats.hpp:223
std::mutex mutex_
Definition perfstats.hpp:222
double minIter(const size_t iter)
Compute the minimum value of the stats data of a given iteration.
double maxIter(const size_t iter)
Compute the maximum value of the stats data of a given iteration.
double sum() const
Compute the sum of all stats data stored so far.
double max() const
Compute the maximum value of all stats data stored so far.
double sumIter(const size_t iter)
Compute the sum value of the stats data of a given iteration.
double meanIter(const size_t iter)
Functions to summarise data of one iteration.
std::map< size_t, std::vector< double > > data_
Definition perfstats.hpp:220
static double meanIter(const std::vector< double > &iter_data_vec)
Static functions to summarise data of one iteration.
double lastIter(const size_t iter)
Provide the last value of the stats data of a given iteration.
double last_absolute_
The last absolute time the stat data was updated.
Definition perfstats.hpp:221
static double minIter(const std::vector< double > &iter_data_vec)
Compute the minimum value of the stats data of an iteration.
double min() const
Compute the minimum value of all stats data stored so far.
double mean() const
Functions to summarise data of the entire stats.
static double lastIter(const std::vector< double > &iter_data_vec)
Provide the last value of the stats data of an iteration.
static double mergeIter(const std::vector< double > &iter_data_vec, const Type type)
Merge the stats data of one interation into a scalar value.
static double maxIter(const std::vector< double > &iter_data_vec)
Compute the maximum value of the stats data of an iteration.
Definition perfstats.hpp:29
int insertion_idx_
The index of the next stat to be inserted to performance stats.
Definition perfstats.hpp:300
size_t iter_
The current iteration.
Definition perfstats.hpp:301
std::vector< PerfStats::Type > header_order_
The order the different types are added to the output.
Definition perfstats.hpp:295
void writeToFilestream()
Write performance stats to filestream.
bool filestream_aligned_
Definition perfstats.hpp:307
double sampleDurationEnd(const std::string &key)
std::string createDataIterString(const size_t iter)
Type
Definition perfstats.hpp:30
@ MEMORY
Definition perfstats.hpp:43
@ POWER
Definition perfstats.hpp:47
@ FRAME
Definition perfstats.hpp:39
@ COORDINATES
Definition perfstats.hpp:32
@ COUNT
Definition perfstats.hpp:33
@ DISTANCE
Definition perfstats.hpp:35
@ VOLTAGE
Definition perfstats.hpp:50
@ UNDEFINED
Definition perfstats.hpp:49
@ ITERATION
Definition perfstats.hpp:42
@ CURRENT
Definition perfstats.hpp:34
@ ORIENTATION
Definition perfstats.hpp:44
@ INT
Definition perfstats.hpp:41
@ FREQUENCY
Definition perfstats.hpp:40
@ ENERGY
Definition perfstats.hpp:38
@ VOLUME
Definition perfstats.hpp:51
@ DURATION
Definition perfstats.hpp:37
@ POSITION
Definition perfstats.hpp:46
@ BOOL
Definition perfstats.hpp:31
@ TIME
Definition perfstats.hpp:48
@ DOUBLE
Definition perfstats.hpp:36
@ PERCENTAGE
Definition perfstats.hpp:45
void setFilestream(std::ofstream *filestream)
void writeSummaryToOStream(std::ostream &ostream, const bool include_iter_data=true)
size_t ostream_last_iter_
Definition perfstats.hpp:312
std::ofstream * filestream_
Definition perfstats.hpp:306
double sampleDurationStart(const std::string &key)
void setIter(const size_t iter)
Set the current iteration and add it to the stats.
Definition perfstats.hpp:274
std::string createDataString()
size_t filestream_last_iter_
Definition perfstats.hpp:308
std::string createDataIterString()
bool ostream_aligned_
Definition perfstats.hpp:311
std::string createHeaderString()
std::map< std::string, Stats > stats_
The map stat name -> stat.
Definition perfstats.hpp:304
const Stats & get(const std::string &key) const
Definition perfstats.hpp:254
std::streampos filestream_pos_
Definition perfstats.hpp:309
double sample(const std::string &key, const double value, const Type type=COUNT)
double sampleT_WB(const Eigen::Isometry3f &T_WB)
void writeToOStream(std::ostream &ostream)
std::map< int, std::string > order_
The order the stats are added to the stats_ map | map idx -> stat name.
Definition perfstats.hpp:303
static double timeNow()
Return the current seconds since the epoch, as measured by std::chrono::steady_clock.