1 #ifndef LOCARNA_STOPWATCH_HH
2 #define LOCARNA_STOPWATCH_HH
10 #include <unordered_map>
26 : running(
false), last_start(0.0), total(0.0), cycles(0) {}
30 typedef std::unordered_map<std::string, timer_t> map_t;
42 explicit StopWatch(
bool print_on_exit =
false);
65 start(
const std::string &name);
75 stop(
const std::string &name);
118 print_info(std::ostream &out,
const std::string &name)
const;
132 current_time()
const;
control a set of named stop watch like timers
Definition: stopwatch.hh:17
StopWatch(bool print_on_exit=false)
Constructor.
Definition: stopwatch.cc:11
void set_print_on_exit(bool print_on_exit)
Definition: stopwatch.cc:20
bool is_running(const std::string &name) const
test whether named timer is running
Definition: stopwatch.cc:54
bool start(const std::string &name)
start a named timer
Definition: stopwatch.cc:25
double current_total(const std::string &name) const
current total time of a named timer
Definition: stopwatch.cc:62
~StopWatch()
Destructor.
Definition: stopwatch.cc:13
bool stop(const std::string &name)
stop a named timer
Definition: stopwatch.cc:38
size_t current_cycles(const std::string &name) const
current start/stop cycles of a named timer
Definition: stopwatch.cc:70
std::ostream & print_info(std::ostream &out, const std::string &name) const
print information for one timer
Definition: stopwatch.cc:78
Definition: aligner.cc:15