WireCellToolkit
Wire Cell Simulation, Signal Process and Reconstruction Toolki for Liquid Argon Detectors
WireCell::TimeKeeper Class Reference

#include <TimeKeeper.h>

Public Types

typedef boost::posix_time::ptime ptime
 
typedef boost::posix_time::time_duration deltat
 
typedef std::pair< ptime, std::string > event
 

Public Member Functions

 TimeKeeper (const std::string &msg="start", ptime starting_time=boost::posix_time::microsec_clock::local_time())
 
 ~TimeKeeper ()
 
ptime start_time () const
 Return the time at which this time keeper was started. More...
 
ptime last_time () const
 Return the time of the last event. More...
 
deltat last_duration () const
 Return the duration between the last two events. More...
 
deltat since (ptime now=boost::posix_time::microsec_clock::local_time()) const
 Return the time duration between "now" and the start time. More...
 
std::string operator() (std::string msg="<tick>", ptime now=boost::posix_time::microsec_clock::local_time())
 Record an event. More...
 
std::string summary () const
 Return summary up to now. More...
 
event operator[] (int ind) const
 Return event by index. More...
 

Detailed Description

A helper class to give some time keeping.

Use like

TimeKeeper tk("starting"); ... tk("starting long calculation...."); do_long_calculation(); tk("...done"); ... info(tk.summary());

Definition at line 21 of file TimeKeeper.h.

Member Typedef Documentation

◆ deltat

typedef boost::posix_time::time_duration WireCell::TimeKeeper::deltat

Definition at line 24 of file TimeKeeper.h.

◆ event

typedef std::pair<ptime, std::string> WireCell::TimeKeeper::event

Definition at line 25 of file TimeKeeper.h.

◆ ptime

typedef boost::posix_time::ptime WireCell::TimeKeeper::ptime

Definition at line 23 of file TimeKeeper.h.

Constructor & Destructor Documentation

◆ TimeKeeper()

TimeKeeper::TimeKeeper ( const std::string &  msg = "start",
ptime  starting_time = boost::posix_time::microsec_clock::local_time() 
)

Definition at line 8 of file TimeKeeper.cxx.

◆ ~TimeKeeper()

TimeKeeper::~TimeKeeper ( )

Definition at line 13 of file TimeKeeper.cxx.

Member Function Documentation

◆ last_duration()

TimeKeeper::deltat TimeKeeper::last_duration ( ) const

Return the duration between the last two events.

Definition at line 31 of file TimeKeeper.cxx.

◆ last_time()

boost::posix_time::ptime TimeKeeper::last_time ( ) const

Return the time of the last event.

Definition at line 27 of file TimeKeeper.cxx.

◆ operator()()

std::string TimeKeeper::operator() ( std::string  msg = "<tick>",
ptime  now = boost::posix_time::microsec_clock::local_time() 
)

Record an event.

Definition at line 17 of file TimeKeeper.cxx.

◆ operator[]()

TimeKeeper::event TimeKeeper::operator[] ( int  ind) const

Return event by index.

Definition at line 41 of file TimeKeeper.cxx.

◆ since()

boost::posix_time::time_duration TimeKeeper::since ( ptime  now = boost::posix_time::microsec_clock::local_time()) const

Return the time duration between "now" and the start time.

Definition at line 36 of file TimeKeeper.cxx.

◆ start_time()

boost::posix_time::ptime TimeKeeper::start_time ( ) const

Return the time at which this time keeper was started.

Definition at line 23 of file TimeKeeper.cxx.

◆ summary()

std::string TimeKeeper::summary ( ) const

Return summary up to now.

Definition at line 48 of file TimeKeeper.cxx.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: