EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
Public Member Functions | List of all members
EGS_Timer Class Reference

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.
 

Detailed Description

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.

Todo:
Should add wall time measurement

Definition at line 57 of file egs_timer.h.


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