STIR 6.5.0
stir::TimedBlock< TimerT=Timer > Class Template Reference

Helper class for measuring execution time of a block of code. More...

#include "stir/TimedBlock.h"

Public Member Functions

 TimedBlock (TimerT &Timer)
 Create a timed block.
virtual ~TimedBlock (void)
 Destroy a timed block.

Detailed Description

template<class TimerT>
class stir::TimedBlock< TimerT=Timer >

Helper class for measuring execution time of a block of code.

It starts the timer in ctor, stops in dtor. Do not create unnamed instances of this class, as they are quite useless: you cannot predict destruction time.

Usage:
SomeTimer t;
// do whatever you want here
{
do_something_1();
do_something_2();
};
// do whatever you want here
{
do_something_3();
};
// do whatever you want here
cout << "It took " << t.GetTime() << "sec to execute do_something_1..3()" << endl;
TimedBlock(TimerT &Timer)
Create a timed block.
Template argument requirements

TimerT has to have a start() and stop() member function. This is the case for stir::Timer (and derived functions) and stir::HighResWallClockTimer.

Constructor & Destructor Documentation

◆ TimedBlock()

template<class TimerT>
stir::TimedBlock< TimerT=Timer >::TimedBlock ( TimerT & Timer)
inline

Create a timed block.

Referenced by ~TimedBlock().

◆ ~TimedBlock()

template<class TimerT>
virtual stir::TimedBlock< TimerT=Timer >::~TimedBlock ( void )
inlinevirtual

Destroy a timed block.

References TimedBlock().


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