ExecMon.h
Go to the documentation of this file.
1 #ifndef WIRECELLUTIL_EXECMON
2 #define WIRECELLUTIL_EXECMON
3 
6 
7 namespace WireCell {
8 
9  /** A helper class combining a TimeKeeper and a MemUsage
10  *
11  * Use like
12  *
13  * ExecMon em("starting");
14  * ...
15  * em("starting long calculation....");
16  * do_long_calculation();
17  * em("...done");
18  * ...
19  * info(em.summary());
20  */
21  class ExecMon {
22  public:
23 
24  ExecMon(const std::string& msg = "start",
25  TimeKeeper::ptime starting_time = boost::posix_time::microsec_clock::local_time());
26  ~ExecMon();
27 
28  /// Record an event.
30  std::string msg = "<tick>",
31  TimeKeeper::ptime now = boost::posix_time::microsec_clock::local_time(),
33 
34  /// Return summary up to now.
35  std::string summary() const;
36 
39  };
40 }
41 #endif
MemUsage mu
Definition: ExecMon.h:38
void msg(const char *fmt,...)
Definition: message.cpp:107
std::string string
Definition: nybbler.cc:12
std::string operator()(std::string msg="<tick>", TimeKeeper::ptime now=boost::posix_time::microsec_clock::local_time(), MemUsage::memusage mu=MemUsage::memusage(-1,-1))
Record an event.
Definition: ExecMon.cxx:12
boost::posix_time::ptime ptime
Definition: TimeKeeper.h:23
Definition: Main.h:22
std::pair< double, double > memusage
Definition: MemUsage.h:21
ExecMon(const std::string &msg="start", TimeKeeper::ptime starting_time=boost::posix_time::microsec_clock::local_time())
Definition: ExecMon.cxx:6
std::string summary() const
Return summary up to now.
Definition: ExecMon.cxx:21
TimeKeeper tk
Definition: ExecMon.h:37