Public Member Functions | Public Attributes | List of all members
WireCell::ExecMon Class Reference

#include <ExecMon.h>

Public Member Functions

 ExecMon (const std::string &msg="start", TimeKeeper::ptime starting_time=boost::posix_time::microsec_clock::local_time())
 
 ~ExecMon ()
 
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. More...
 
std::string summary () const
 Return summary up to now. More...
 

Public Attributes

TimeKeeper tk
 
MemUsage mu
 

Detailed Description

A helper class combining a TimeKeeper and a MemUsage

Use like

ExecMon em("starting"); ... em("starting long calculation...."); do_long_calculation(); em("...done"); ... info(em.summary());

Definition at line 21 of file ExecMon.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file ExecMon.cxx.

7  : tk(msg, starting_time)
8  , mu(msg) { }
MemUsage mu
Definition: ExecMon.h:38
void msg(const char *fmt,...)
Definition: message.cpp:107
TimeKeeper tk
Definition: ExecMon.h:37
ExecMon::~ExecMon ( )

Definition at line 10 of file ExecMon.cxx.

10 { }

Member Function Documentation

std::string ExecMon::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 at line 12 of file ExecMon.cxx.

13 {
14  std::stringstream ss;
15  ss << "Time: " << tk(msg,now) << "\n"
16  << "Memory: " << mu(msg,mumu);
17  return ss.str();
18 }
MemUsage mu
Definition: ExecMon.h:38
void msg(const char *fmt,...)
Definition: message.cpp:107
TimeKeeper tk
Definition: ExecMon.h:37
std::string ExecMon::summary ( ) const

Return summary up to now.

Definition at line 21 of file ExecMon.cxx.

22 {
23  std::stringstream ss;
24  ss << "Time summary:\n" << tk.summary() << "\nMemory usage:\n" << mu.summary();
25  return ss.str();
26 }
MemUsage mu
Definition: ExecMon.h:38
std::string summary() const
Return summary up to now.
Definition: MemUsage.cxx:101
std::string summary() const
Return summary up to now.
Definition: TimeKeeper.cxx:48
TimeKeeper tk
Definition: ExecMon.h:37

Member Data Documentation

MemUsage WireCell::ExecMon::mu

Definition at line 38 of file ExecMon.h.

TimeKeeper WireCell::ExecMon::tk

Definition at line 37 of file ExecMon.h.


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