LocARNA-1.8.11
Classes | Public Member Functions | List of all members
LocARNA::StopWatch Class Reference

control a set of named stop watch like timers More...

#include <stopwatch.hh>

Public Member Functions

 StopWatch (bool print_on_exit=false)
 Constructor. More...
 
 ~StopWatch ()
 Destructor.
 
void set_print_on_exit (bool print_on_exit)
 
bool start (const std::string &name)
 start a named timer More...
 
bool stop (const std::string &name)
 stop a named timer More...
 
bool is_running (const std::string &name) const
 test whether named timer is running More...
 
double current_total (const std::string &name) const
 current total time of a named timer More...
 
size_t current_cycles (const std::string &name) const
 current start/stop cycles of a named timer More...
 
std::ostream & print_info (std::ostream &out, const std::string &name) const
 print information for one timer More...
 
std::ostream & print_info (std::ostream &out) const
 print information for all timers More...
 

Detailed Description

control a set of named stop watch like timers

Constructor & Destructor Documentation

LocARNA::StopWatch::StopWatch ( bool  print_on_exit = false)
explicit

Constructor.

Parameters
print_on_exitwhether to automatically print times on exit

Member Function Documentation

size_t LocARNA::StopWatch::current_cycles ( const std::string &  name) const

current start/stop cycles of a named timer

Parameters
nametimer name
Returns
cycles (including started cycle if running)
double LocARNA::StopWatch::current_total ( const std::string &  name) const

current total time of a named timer

Parameters
nametimer name
Returns
time (if running add time since start)
bool LocARNA::StopWatch::is_running ( const std::string &  name) const

test whether named timer is running

Parameters
nametimer name
Returns
running?
std::ostream & LocARNA::StopWatch::print_info ( std::ostream &  out,
const std::string &  name 
) const

print information for one timer

Parameters
outoutput stream
name
Note
determine current running time for running timers
Returns
output stream
std::ostream & LocARNA::StopWatch::print_info ( std::ostream &  out) const

print information for all timers

Parameters
outoutput stream
Returns
output stream
void LocARNA::StopWatch::set_print_on_exit ( bool  print_on_exit)

Control automatic printing of times at exit

Parameters
print_on_exitwhether to print on exit
bool LocARNA::StopWatch::start ( const std::string &  name)

start a named timer

Parameters
nametimer name
Returns
success
bool LocARNA::StopWatch::stop ( const std::string &  name)

stop a named timer

Parameters
nametimer name
Returns
success

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