iRoCS Toolbox  1.1.0
Public Member Functions
atb::Timer Class Reference

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>

Collaboration diagram for atb::Timer:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Timer()

atb::Timer::Timer ( std::ostream &  outStream = std::cout)

Constructor - creating a new Timer.

Parameters
outStreamThe output of the Tmier will be sent to the output stream specified

◆ ~Timer()

atb::Timer::~Timer ( )

Destructor - Cleaning up Timer ressources.

Member Function Documentation

◆ tic()

void atb::Timer::tic ( const std::string &  output = "")

Start the timer showing the optional message output.

Parameters
outputA message that is shown additional to the default "Starting stopwatch..." output

◆ toc()

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


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