39 #ifndef INCLUDE_OKVIS_TIMING_TIMER_HPP_
40 #define INCLUDE_OKVIS_TIMING_TIMER_HPP_
42 #ifndef BOOST_DATE_TIME_NO_LOCALE
43 #define BOOST_DATE_TIME_NO_LOCALE
44 #include <boost/date_time/posix_time/posix_time.hpp>
45 #undef BOOST_DATE_TIME_NO_LOCALE
47 #include <boost/date_time/posix_time/posix_time.hpp>
51 #include <boost/accumulators/accumulators.hpp>
52 #include <boost/accumulators/statistics.hpp>
53 #include <boost/accumulators/statistics/rolling_mean.hpp>
54 #include <unordered_map>
60 #define OKVIS_USE_HIGH_PERF_TIMER
72 TimerMapValue() : m_acc(boost::accumulators::tag::rolling_window::window_size = 50){}
73 boost::accumulators::accumulator_set<
75 boost::accumulators::features<
76 boost::accumulators::tag::lazy_variance,
77 boost::accumulators::tag::sum,
78 boost::accumulators::tag::min,
79 boost::accumulators::tag::max,
80 boost::accumulators::tag::rolling_mean,
81 boost::accumulators::tag::mean
106 Timer(
size_t handle,
bool constructStopped =
false);
107 Timer(std::string
const & tag,
bool constructStopped =
false);
115 #ifdef OKVIS_USE_HIGH_PERF_TIMER
128 static size_t getHandle(std::string
const & tag);
129 static std::string
getTag(
size_t handle);
142 static double getHz(
size_t handle);
143 static double getHz(std::string
const & tag);
144 static void print(std::ostream & out);
145 static void reset(
size_t handle);
146 static void reset(std::string
const & tag);
147 static std::string
print();
151 void addTime(
size_t handle,
double seconds);
159 typedef std::unordered_map<std::string,size_t>
map_t;
160 typedef std::vector<TimerMapValue>
list_t;
167 #ifdef OKVIS_USE_HIGH_PERF_TIMER
168 double m_clockPeriod;
183 #endif // INCLUDE_OKVIS_TIMING_TIMER_HPP_
TimerMapValue()
Definition: Timer.hpp:72
void start()
Definition: Timer.hpp:98
static double getMeanSeconds(size_t handle)
Definition: Timer.cpp:169
DummyTimer(std::string const &)
Definition: Timer.hpp:94
static double getMaxSeconds(size_t handle)
Definition: Timer.cpp:197
void start()
Definition: Timer.cpp:120
~DummyTimer()
Definition: Timer.hpp:96
static std::string print()
Definition: Timer.cpp:274
static size_t getHandle(std::string const &tag)
Definition: Timer.cpp:62
void stop()
Definition: Timer.hpp:99
static std::string secondsToTimeString(double seconds)
Definition: Timer.cpp:226
DummyTimer(size_t, bool)
Definition: Timer.hpp:92
~Timer()
Definition: Timer.cpp:115
static double getVarianceSeconds(size_t handle)
Definition: Timer.cpp:183
~Timing()
Definition: Timer.cpp:57
static double getTotalSeconds(size_t handle)
Definition: Timer.cpp:162
static double getHz(size_t handle)
Definition: Timer.cpp:205
void discardTiming()
Definition: Timer.hpp:100
list_t m_timers
Definition: Timer.hpp:165
static void reset(size_t handle)
Definition: Timer.cpp:216
boost::accumulators::accumulator_set< double, boost::accumulators::features< boost::accumulators::tag::lazy_variance, boost::accumulators::tag::sum, boost::accumulators::tag::min, boost::accumulators::tag::max, boost::accumulators::tag::rolling_mean, boost::accumulators::tag::mean > > m_acc
Definition: Timer.hpp:83
Definition: Timer.hpp:104
Timer(size_t handle, bool constructStopped=false)
Definition: Timer.cpp:98
static size_t getNumSamples(size_t handle)
Definition: Timer.cpp:176
DummyTimer(size_t)
Definition: Timer.hpp:93
#define OKVIS_DEFINE_EXCEPTION(exceptionName, exceptionParent)
Macro for defining an exception with a given parent.
Definition: assert_macros.hpp:52
This file contains some useful assert macros.
boost::posix_time::ptime m_time
Definition: Timer.hpp:118
std::mutex addNewHandleMutex_
Definition: Timer.hpp:162
Timer DebugTimer
Definition: Timer.hpp:177
Timing()
Definition: Timer.cpp:46
void addTime(size_t handle, double seconds)
Definition: Timer.cpp:158
Definition: Timer.hpp:124
std::vector< TimerMapValue > list_t
Definition: Timer.hpp:160
static Timing & instance()
Definition: Timer.cpp:41
DummyTimer(std::string const &, bool)
Definition: Timer.hpp:95
map_t m_tagMap
Definition: Timer.hpp:166
void stop()
Definition: Timer.cpp:130
bool isTiming()
Definition: Timer.hpp:101
static std::string getTag(size_t handle)
Definition: Timer.cpp:79
size_t m_handle
Definition: Timer.hpp:121
void discardTiming()
Definition: Timer.cpp:152
bool isTiming()
Definition: Timer.cpp:147
static double getMinSeconds(size_t handle)
Definition: Timer.cpp:190
std::unordered_map< std::string, size_t > map_t
Definition: Timer.hpp:159
bool m_timing
Definition: Timer.hpp:120
size_t m_maxTagLength
Definition: Timer.hpp:170