Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Timer Class Reference

#include <G4Timer.hh>

Public Member Functions

 G4Timer ()
 
void Start ()
 
void Stop ()
 
G4bool IsValid () const
 
const char * GetClockTime () const
 
G4double GetRealElapsed () const
 
G4double GetSystemElapsed () const
 
G4double GetUserElapsed () const
 

Detailed Description

Definition at line 108 of file G4Timer.hh.

Constructor & Destructor Documentation

◆ G4Timer()

G4Timer::G4Timer ( )

Definition at line 117 of file G4Timer.cc.

118 : fValidTimes(false)
119{}

Member Function Documentation

◆ GetClockTime()

const char * G4Timer::GetClockTime ( ) const
inline

◆ GetRealElapsed()

G4double G4Timer::GetRealElapsed ( ) const

Definition at line 121 of file G4Timer.cc.

122{
123 if(!fValidTimes)
124 {
125 G4Exception("G4Timer::GetRealElapsed()", "InvalidCondition", FatalException,
126 "Timer not stopped or times not recorded!");
127 }
128 std::chrono::duration<G4double> diff = fEndRealTime - fStartRealTime;
129 return diff.count();
130}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

Referenced by operator<<().

◆ GetSystemElapsed()

G4double G4Timer::GetSystemElapsed ( ) const

Definition at line 132 of file G4Timer.cc.

133{
134 if(!fValidTimes)
135 {
136 G4Exception("G4Timer::GetSystemElapsed()", "InvalidCondition",
137 FatalException, "Timer not stopped or times not recorded!");
138 }
139 G4double diff = fEndTimes.tms_stime - fStartTimes.tms_stime;
140 return diff / sysconf(_SC_CLK_TCK);
141}
double G4double
Definition: G4Types.hh:83

Referenced by G4ConvergenceTester::AddScore(), operator<<(), and G4RunManager::ReOptimize().

◆ GetUserElapsed()

G4double G4Timer::GetUserElapsed ( ) const

Definition at line 143 of file G4Timer.cc.

144{
145 if(!fValidTimes)
146 {
147 G4Exception("G4Timer::GetUserElapsed()", "InvalidCondition", FatalException,
148 "Timer not stopped or times not recorded");
149 }
150 G4double diff = fEndTimes.tms_utime - fStartTimes.tms_utime;
151 return diff / sysconf(_SC_CLK_TCK);
152}

Referenced by G4ConvergenceTester::AddScore(), G4VXTRenergyLoss::BuildAngleForEnergyBank(), G4VXTRenergyLoss::BuildAngleTable(), G4VXTRenergyLoss::BuildEnergyTable(), G4VXTRenergyLoss::BuildGlobalAngleTable(), operator<<(), and G4RunManager::ReOptimize().

◆ IsValid()

G4bool G4Timer::IsValid ( ) const
inline

Referenced by operator<<().

◆ Start()

◆ Stop()


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