File timer.hpp

This file contains an efficient timer class, which is used to retrieve execution times for various parts of the algorithms.

Author

Benjamin Lindner ben@benlabs.net

Version

See VERSION in CMakeLists.txt

Copyright

GNU General Public License

class Timer_timeval
#include <timer.hpp>

Type class which respresents the time value used by the Timer class.

Public Functions

Timer_timeval() = default
inline explicit Timer_timeval(const timeval &t)
inline Timer_timeval &operator=(const timeval &t)

Public Members

long tv_sec = 0
long tv_usec = 0

Private Functions

template<class Archive>
inline void serialize(Archive &ar, const unsigned int version)

Friends

friend class boost::serialization::access
class Timer
#include <timer.hpp>

Basic Timer which provides a start/stop facility measure runtimes. Provides an interface to retrieve statistical information.

Public Functions

std::vector<std::string> keys()
void start(const std::string &tk)
void stop(const std::string &tk)
double sum(const std::string &tk)
double min(const std::string &tk)
double max(const std::string &tk)
double mean(const std::string &tk)
double variance(const std::string &tk)
double count(const std::string &tk)
void clear()
bool has_key(const std::string &tk)

Private Types

using times_type = boost::accumulators::accumulator_set<double, features<tag::min, tag::max, tag::mean, tag::variance, tag::sum, tag::count>>

Private Functions

template<class Archive>
inline void serialize(Archive &ar, const unsigned int version)
double t_diff(timeval start, timeval end)
double t_diff(Timer_timeval start, timeval end)

Private Members

std::map<std::string, times_type> times
std::map<std::string, Timer_timeval> starttimes
std::map<std::string, bool> states

Friends

friend class boost::serialization::access