EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
|
A simple class for measuring CPU time. More...
#include <egs_timer.h>
Public Member Functions | |
EGS_Timer () | |
Construct an EGS_Timer object. | |
~EGS_Timer () | |
Destructor. | |
void | start () |
Starts the time measurement. | |
EGS_Float | time () |
Returns the CPU time in seconds since start() was called. | |
A simple class for measuring CPU time.
The reson for the existence of this simple class is the fact that on Linux the CLOCKS_PER_SEC macro is equal to 1e6/second so that the clock() function, which returns the CPU time in units of CLOCKS_PER_SEC runs out only after about 40 minutes on 32 bit systems where an unsigned 32 bit integer variable is used. This is not very long for a Monte Carlo simulation.
Definition at line 57 of file egs_timer.h.