10 m_events.push_back(
event(starting_time, msg));
13 TimeKeeper::~TimeKeeper()
19 m_events.push_back(
event(now, msg));
23 boost::posix_time::ptime TimeKeeper::start_time()
const 25 return (*
this)[0].first;
27 boost::posix_time::ptime TimeKeeper::last_time()
const 29 return (*
this)[-1].first;
33 return (*
this)[-1].first - (*this)[-2].first;
36 boost::posix_time::time_duration TimeKeeper::since(
ptime now)
const 38 return now - start_time();
43 while (ind < 0) { ind += m_events.size();}
51 for (
size_t ind=0; ind<m_events.size(); ++ind) {
52 ss << this->emit(ind) <<
"\n";
59 while (ind < 0) { ind += m_events.size();}
61 if (prev_ind<0) prev_ind=0;
62 const event& prev = (*this)[prev_ind];
63 const event&
evt = (*this)[ind];
66 deltat from_last =
evt.first - prev.first;
69 ss <<
"TICK: " << from_start.total_milliseconds() <<
" ms " 70 <<
"(this: " << from_last.total_milliseconds() <<
" ms) " void msg(const char *fmt,...)
boost::posix_time::ptime ptime
std::pair< ptime, std::string > event
boost::posix_time::time_duration deltat