1 #ifndef WIRECELLUTIL_TIMEKEEPER 2 #define WIRECELLUTIL_TIMEKEEPER 4 #include <boost/date_time/posix_time/posix_time_types.hpp> 23 typedef boost::posix_time::ptime
ptime;
24 typedef boost::posix_time::time_duration
deltat;
25 typedef std::pair<ptime, std::string>
event;
28 ptime starting_time = boost::posix_time::microsec_clock::local_time());
41 deltat
since(ptime
now = boost::posix_time::microsec_clock::local_time())
const;
46 ptime
now = boost::posix_time::microsec_clock::local_time());
ptime start_time() const
Return the time at which this time keeper was started.
void msg(const char *fmt,...)
event operator[](int ind) const
Return event by index.
std::string emit(int ind) const
Emit a formatted message for the given event index.
deltat since(ptime now=boost::posix_time::microsec_clock::local_time()) const
Return the time duration between "now" and the start time.
TimeKeeper(const std::string &msg="start", ptime starting_time=boost::posix_time::microsec_clock::local_time())
deltat last_duration() const
Return the duration between the last two events.
boost::posix_time::ptime ptime
std::string summary() const
Return summary up to now.
std::pair< ptime, std::string > event
ptime last_time() const
Return the time of the last event.
std::vector< event > m_events
std::string operator()(std::string msg="<tick>", ptime now=boost::posix_time::microsec_clock::local_time())
Record an event.
boost::posix_time::time_duration deltat