Sierra Toolkit  Version of the Day
stk_classic::diag::TimeBlock Class Reference

#include <Timer.hpp>

Public Member Functions

 TimeBlock (Timer &timer, bool start_timer=true)
 
 ~TimeBlock ()
 
void start ()
 
void lap ()
 
void stop ()
 

Detailed Description

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.

Definition at line 495 of file Timer.hpp.

Constructor & Destructor Documentation

◆ TimeBlock()

stk_classic::diag::TimeBlock::TimeBlock ( Timer timer,
bool  start_timer = true 
)
inlineexplicit

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.

Parameters
timera Timer reference to the timer accumulate block run times.
start_timera bool value to have the timer started on construction.

Definition at line 511 of file Timer.hpp.

◆ ~TimeBlock()

stk_classic::diag::TimeBlock::~TimeBlock ( )
inline

Destroys a TimeBlock instance. Stops the timer if is has been started.

Definition at line 528 of file Timer.hpp.

Member Function Documentation

◆ start()

void stk_classic::diag::TimeBlock::start ( )
inline

Member function start starts the timer associated with the time block.

Definition at line 541 of file Timer.hpp.

◆ lap()

void stk_classic::diag::TimeBlock::lap ( )
inline

Member function lap sets the stop time of the timer associated with the time block.

Definition at line 551 of file Timer.hpp.

◆ stop()

void stk_classic::diag::TimeBlock::stop ( )
inline

Member function stop stops the timer associated with the time block.

Definition at line 559 of file Timer.hpp.


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