97#include <boost/operators.hpp>
100#ifndef WINDOWS_LEAN_AND_MEAN
101#define WINDOWS_LEAN_AND_MEAN
102#define ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN 1
105#if ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN
106#undef WINDOWS_LEAN_AND_MEAN
107#undef ADOBE_UNDEFINE_WINDOWS_LEAN_AND_MEAN
122class timer_t : boost::totally_ordered<timer_t> {
123 using value_type = std::chrono::time_point<std::chrono::high_resolution_clock>;
125 typedef std::vector<double> accumulator_type;
130#ifndef ADOBE_NO_DOCUMENTATION
137 : epoch_m(rhs.epoch_m), split_m(rhs.split_m), time_set_m(rhs.time_set_m)
142 epoch_m = rhs.epoch_m;
143 split_m = rhs.split_m;
144 time_set_m = rhs.time_set_m;
156 epoch_m = std::chrono::high_resolution_clock::now();
171 const std::chrono::duration<double, std::milli> delta{
172 std::chrono::high_resolution_clock::now() - epoch_m};
173 return delta.count();
181 time_set_m.push_back(
split());
217 return (
size() % 2 == 1)
218 ? time_set_m[time_set_m.size() / 2]
219 : (time_set_m[time_set_m.size() / 2] + time_set_m[time_set_m.size() / 2 - 1]) /
242 inline bool empty()
const {
return time_set_m.empty(); }
252 inline void report(
const char* decoration, std::ostream& s = std::cout) {
253 double time(
split());
255 s << decoration <<
" took " << time <<
" milliseconds (" << time / 1e3 <<
" sec)"
262#ifndef ADOBE_NO_DOCUMENTATION
269 mutable accumulator_type time_set_m;
274#ifndef ADOBE_NO_DOCUMENTATION
double accrued_max() const
timer_t & operator=(const timer_t &rhs)
friend bool operator<(const timer_t &x, const timer_t &y)
double accrued_median() const
void report(const char *decoration, std::ostream &s=std::cout)
accumulator_type::size_type size_type
double accrued_total() const
timer_t(const timer_t &rhs)
double accrued_min() const
double accrued_average() const
friend bool operator==(const timer_t &x, const timer_t &y)
T accumulate(const InputRange &range, T init)
bool operator<(const step_iterator_adaptor< D, IT, S_FN > &p1, const step_iterator_adaptor< D, IT, S_FN > &p2)
boost::range_iterator< ForwardRange >::type min_element(ForwardRange &range)
minmax implementation
boost::range_iterator< ForwardRange >::type max_element(ForwardRange &range)
minmax implementation
void sort(RandomAccessRange &range)
sort implementation
bool operator==(const any_regular_t &x, const any_regular_t &y)