17 #ifndef SE_PERFSTATS_HPP 18 #define SE_PERFSTATS_HPP 21 # include <mach/clock.h> 22 # include <mach/mach.h> 26 #include <Eigen/Dense> 71 static double meanIter(
const std::vector<double>& iter_data_vec);
80 static double lastIter(
const std::vector<double>& iter_data_vec);
89 static double minIter(
const std::vector<double>& iter_data_vec);
98 static double maxIter(
const std::vector<double>& iter_data_vec);
107 static double sumIter(
const std::vector<double>& iter_data_vec);
117 static double mergeIter(
const std::vector<double>& iter_data_vec,
const Type type);
146 double minIter(
const size_t iter);
155 double maxIter(
const size_t iter);
164 double sumIter(
const size_t iter);
219 double merge()
const;
228 std::map<size_t, std::vector<double>>
data_;
289 const Stats&
get(
const std::string& key)
const 291 return stats_.find(key)->second;
300 std::vector<double>
getLastData(
const std::string& key);
346 void reset(
const std::string& key);
357 double sample(
const std::string& key,
360 const bool detailed =
false);
362 double sampleT_WB(
const Eigen::Matrix4f& T_WB,
const bool detailed =
false);
458 std::map<int, std::string>
472 #include "impl/perfstats_impl.hpp" 483 #endif // SE_PERFSTATS_HPP std::ofstream * filestream_
IO function.
Definition: perfstats.hpp:463
double sampleT_WB(const Eigen::Matrix4f &T_WB, const bool detailed=false)
bool include_detailed_
Flag to add stats marked as detailed to the output.
Definition: perfstats.hpp:454
Definition: perfstats.hpp:46
std::map< size_t, std::vector< double > > data_
Definition: perfstats.hpp:228
Definition: perfstats.hpp:47
double sampleDurationStart(const std::string &key, const bool detailed=false)
size_t filestream_last_iter_
Definition: perfstats.hpp:465
Definition: perfstats.hpp:44
Definition: perfstats.hpp:49
static double meanIter(const std::vector< double > &iter_data_vec)
Static functions to summarise data of one iteration.
double sample(const std::string &key, const double value, const Type type=COUNT, const bool detailed=false)
Definition: perfstats.hpp:41
Definition: perfstats.hpp:62
double mean() const
Functions to summarise data of the entire stats.
void writeSummaryToOStream(std::ostream &ostream, const bool include_iter_data=true)
Definition: perfstats.hpp:43
std::string createDataIterString()
static double sumIter(const std::vector< double > &iter_data_vec)
Compute the sum of the values 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.
bool filestream_aligned_
Definition: perfstats.hpp:464
static double lastIter(const std::vector< double > &iter_data_vec)
Provide the last value of the stats data of an iteration.
std::string createHeaderString()
double mean
Definition: perfstats.hpp:237
double last() const
Provide the last stored value to the stats data.
Definition: perfstats.hpp:56
double getSampleTime(const std::string &key)
bool detailed_
Flag indicating if the stat should be excluded from basic string output.
Definition: perfstats.hpp:230
Definition: perfstats.hpp:57
std::mutex mutex_
Definition: perfstats.hpp:232
double sum
Definition: perfstats.hpp:240
void setIter(const size_t iter)
Set the current iteration and add it to the stats.
Definition: perfstats.hpp:406
double getLastDataMerged(const std::string &key)
double sampleDurationEnd(const std::string &key)
double merge() const
Merge all stats data into a scalar value.
std::map< int, std::string > order_
The order the stats are added to the stats_ map | map idx -> stat name.
Definition: perfstats.hpp:459
std::map< std::string, Stats > stats_
The map stat name -> stat.
Definition: perfstats.hpp:460
std::string createDataString()
void writeToFilestream()
Write performance stats to filestream.
double min() const
Compute the minimum value of all stats data stored so far.
double sum() const
Compute the sum of all stats data stored so far.
static double minIter(const std::vector< double > &iter_data_vec)
Compute the minimum value of the stats data of an iteration.
void includeDetailed(const bool include_detailed)
Set flag to include detailed stats to std::string output.
Definition: perfstats.hpp:392
Definition: perfstats.hpp:53
Definition: perfstats.hpp:45
Definition: perfstats.hpp:59
Definition: perfstats.hpp:52
Definition: perfstats.hpp:55
Definition: perfstats.hpp:38
int insertion_idx_
The index of the next stat to be inserted to performance stats.
Definition: perfstats.hpp:456
Type type_
The type of data stored in the stat struct.
Definition: perfstats.hpp:233
double max
Definition: perfstats.hpp:239
size_t ostream_last_iter_
Definition: perfstats.hpp:469
static double maxIter(const std::vector< double > &iter_data_vec)
Compute the maximum value of the stats data of an iteration.
bool ostream_aligned_
Definition: perfstats.hpp:468
void writeToOStream(std::ostream &ostream)
double last_absolute_
The last absolute time the stat data was updated.
Definition: perfstats.hpp:231
Definition: perfstats.hpp:40
std::streampos filestream_pos_
Definition: perfstats.hpp:466
void setFilestream(std::ofstream *filestream)
Type getType(const std::string &key)
Type
Definition: perfstats.hpp:39
Definition: perfstats.hpp:54
Definition: perfstats.hpp:236
double min
Definition: perfstats.hpp:238
Definition: perfstats.hpp:51
std::vector< double > getLastData(const std::string &key)
Definition: perfstats.hpp:50
std::vector< PerfStats::Type > header_order_
The order the different types are added to the output.
Definition: perfstats.hpp:434
Definition: perfstats.hpp:58
double max() const
Compute the maximum value of all stats data stored so far.
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
Definition: perfstats.hpp:48
size_t iter_
The current iteration.
Definition: perfstats.hpp:457
Definition: perfstats.hpp:42