RobWorkProject  23.9.11-
Public Member Functions | List of all members
ScopedTimer Class Reference

Times what is executed in a scope. More...

#include <ScopedTimer.hpp>

Public Member Functions

 ScopedTimer (rw::common::Timer &timer)
 constructor. Starts the timer More...
 
virtual ~ScopedTimer ()
 destructor, stops the timer
 
rw::common::TimergetTimer ()
 Returns the time wrapped in the ScopedTimer. More...
 

Detailed Description

Times what is executed in a scope.

Automatically calls resume on the timer given in construction and pause when destroyed.

Note
usage
...
long time;
{
// put code here that is not to be timed
ScopedTimer timer(time);
// put code here that is to be timed
}
std::cout << "Time: " << time << std::endl;
ScopedTimer(rw::common::Timer &timer)
constructor. Starts the timer
Definition: ScopedTimer.hpp:50

Constructor & Destructor Documentation

◆ ScopedTimer()

ScopedTimer ( rw::common::Timer timer)
inline

constructor. Starts the timer

Parameters
timer

Member Function Documentation

◆ getTimer()

rw::common::Timer& getTimer ( )
inline

Returns the time wrapped in the ScopedTimer.

Returns
Timer wrapped

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