Package org.robwork.sdurw_common
Class ScopedTimer
- java.lang.Object
-
- org.robwork.sdurw_common.ScopedTimer
-
public class ScopedTimer extends java.lang.Object
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;
-
-
Constructor Summary
Constructors Constructor Description ScopedTimer(long cPtr, boolean cMemoryOwn)
ScopedTimer(Timer timer)
constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
static long
getCPtr(ScopedTimer obj)
Timer
getTimer()
Returns the time wrapped in the ScopedTimer
-
-
-
Constructor Detail
-
ScopedTimer
public ScopedTimer(long cPtr, boolean cMemoryOwn)
-
ScopedTimer
public ScopedTimer(Timer timer)
constructor. Starts the timer- Parameters:
timer
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(ScopedTimer obj)
-
delete
public void delete()
-
getTimer
public Timer getTimer()
Returns the time wrapped in the ScopedTimer- Returns:
- Timer wrapped
-
-