iRoCS Toolbox
1.1.0
|
The Timer class provides a simple stop-watch in microsecond accuracy for simple profiling tasks (similar to tic - toc in MATLAB) More...
#include <ATBTiming.hh>
Public Member Functions | |
Timer (std::ostream &outStream=std::cout) | |
Constructor - creating a new Timer. More... | |
~Timer () | |
Destructor - Cleaning up Timer ressources. More... | |
void | tic (const std::string &output="") |
Start the timer showing the optional message output. More... | |
long long | toc () |
Stop the timer showing the elapsed time since the last timer start pretty printed in microsecond accuracy. More... | |
The Timer class provides a simple stop-watch in microsecond accuracy for simple profiling tasks (similar to tic - toc in MATLAB)
To use the stop-watch create a Timer object. Call tic(), to start the watch and toc() to stop it. Both functions will send a message to std::cout.
Definition at line 112 of file ATBTiming.hh.
atb::Timer::Timer | ( | std::ostream & | outStream = std::cout | ) |
Constructor - creating a new Timer.
outStream | The output of the Tmier will be sent to the output stream specified |
atb::Timer::~Timer | ( | ) |
Destructor - Cleaning up Timer ressources.
void atb::Timer::tic | ( | const std::string & | output = "" | ) |
Start the timer showing the optional message output.
output | A message that is shown additional to the default "Starting stopwatch..." output |
long long atb::Timer::toc | ( | ) |
Stop the timer showing the elapsed time since the last timer start pretty printed in microsecond accuracy.
Output format is hh:mm:ss.ms,mu
return The time in microseconds since the last tic() call