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

#include <G4Timer.hh>

Public Member Functions

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.

Member Function Documentation

◆ GetClockTime()

const char * G4Timer::GetClockTime ( ) const
inline

◆ GetRealElapsed()

G4double G4Timer::GetRealElapsed ( ) const

Definition at line 113 of file G4Timer.cc.

114{
115 if(!fValidTimes)
116 {
117 G4Exception("G4Timer::GetRealElapsed()", "InvalidCondition", FatalException,
118 "Timer not stopped or times not recorded!");
119 }
120 std::chrono::duration<G4double> diff = fEndRealTime - fStartRealTime;
121 return diff.count();
122}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59

Referenced by operator<<(), and G4VViewer::ProcessView().

◆ GetSystemElapsed()

G4double G4Timer::GetSystemElapsed ( ) const

Definition at line 124 of file G4Timer.cc.

125{
126 if(!fValidTimes)
127 {
128 G4Exception("G4Timer::GetSystemElapsed()", "InvalidCondition",
129 FatalException, "Timer not stopped or times not recorded!");
130 }
131 G4double diff = fEndTimes.tms_stime - fStartTimes.tms_stime;
132 return diff / sysconf(_SC_CLK_TCK);
133}
double G4double
Definition: G4Types.hh:83

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

◆ GetUserElapsed()

G4double G4Timer::GetUserElapsed ( ) const

Definition at line 135 of file G4Timer.cc.

136{
137 if(!fValidTimes)
138 {
139 G4Exception("G4Timer::GetUserElapsed()", "InvalidCondition", FatalException,
140 "Timer not stopped or times not recorded");
141 }
142 G4double diff = fEndTimes.tms_utime - fStartTimes.tms_utime;
143 return diff / sysconf(_SC_CLK_TCK);
144}

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: