|
Sierra Toolkit Version of the Day
|
Class TimeBlock is a time sentry for timing a statement block. More...
#include <Timer.hpp>
Public Member Functions | |
| TimeBlock (Timer &timer, bool start_timer=true) | |
| Creates a new TimeBlock instance. | |
| ~TimeBlock () | |
| Destroys a TimeBlock instance. | |
| void | start () |
| Member function start starts the timer associated with the time block. | |
| void | lap () |
| Member function lap sets the stop time of the timer associated with the time block. | |
| void | stop () |
| Member function stop stops the timer associated with the time block. | |
Class TimeBlock is a time sentry for timing a statement block.
The timer is generally started upon construction. But, the start is delayed if the second argument is false. In this case, manually start the timer by calling the start() function. This gives the safety of using a sentry, but does not force to awkwardness associated with local variables crossing the timed block.
| stk::diag::TimeBlock::TimeBlock | ( | Timer & | timer, |
| bool | start_timer = true |
||
| ) | [inline, explicit] |
Creates a new TimeBlock instance.
The newly created instance will start the timer if the start value is true, which is the default case. If the start value is false, the calling function is responsible for starting the timer at the appropriate time.
| timer | a Timer reference to the timer accumulate block run times. |
| start_timer | a bool value to have the timer started on construction. |
| stk::diag::TimeBlock::~TimeBlock | ( | ) | [inline] |