Geant4 9.6.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 110 of file G4Timer.hh.

Constructor & Destructor Documentation

◆ G4Timer()

G4Timer::G4Timer ( )

Definition at line 102 of file G4Timer.cc.

103 : fValidTimes(false)
104{
105}

Member Function Documentation

◆ GetClockTime()

const char * G4Timer::GetClockTime ( ) const
inline

◆ GetRealElapsed()

G4double G4Timer::GetRealElapsed ( ) const

Definition at line 107 of file G4Timer.cc.

108{
109 if (!fValidTimes)
110 {
111 G4Exception("G4Timer::GetRealElapsed()", "InvalidCondition",
112 FatalException, "Timer not stopped or times not recorded!");
113 }
114 G4double diff=fEndRealTime-fStartRealTime;
115 return diff/sysconf(_SC_CLK_TCK);
116}
@ FatalException
double G4double
Definition: G4Types.hh:64
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by operator<<().

◆ GetSystemElapsed()

G4double G4Timer::GetSystemElapsed ( ) const

Definition at line 119 of file G4Timer.cc.

120{
121 if (!fValidTimes)
122 {
123 G4Exception("G4Timer::GetSystemElapsed()", "InvalidCondition",
124 FatalException, "Timer not stopped or times not recorded!");
125 }
126 G4double diff=fEndTimes.tms_stime-fStartTimes.tms_stime;
127 return diff/sysconf(_SC_CLK_TCK);
128}

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

◆ GetUserElapsed()

G4double G4Timer::GetUserElapsed ( ) const

Definition at line 130 of file G4Timer.cc.

131{
132 if (!fValidTimes)
133 {
134 G4Exception("G4Timer::GetUserElapsed()", "InvalidCondition",
135 FatalException, "Timer not stopped or times not recorded");
136 }
137 G4double diff=fEndTimes.tms_utime-fStartTimes.tms_utime;
138 return diff/sysconf(_SC_CLK_TCK);
139}

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

◆ IsValid()

G4bool G4Timer::IsValid ( ) const
inline

Referenced by operator<<().

◆ Start()

◆ Stop()


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