Geant4  10.02.p03
G4Timer Class Reference

#include <G4Timer.hh>

Collaboration diagram for G4Timer:

Public Member Functions

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

Private Attributes

G4bool fValidTimes
 
clock_t fStartRealTime
 
clock_t fEndRealTime
 
tms fStartTimes
 
tms fEndTimes
 

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 }
G4bool fValidTimes
Definition: G4Timer.hh:126

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  }
115  return diff/sysconf(_SC_CLK_TCK);
116 }
G4bool fValidTimes
Definition: G4Timer.hh:126
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
clock_t fStartRealTime
Definition: G4Timer.hh:127
clock_t fEndRealTime
Definition: G4Timer.hh:127
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 }
G4bool fValidTimes
Definition: G4Timer.hh:126
tms fStartTimes
Definition: G4Timer.hh:128
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
tms fEndTimes
Definition: G4Timer.hh:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 }
G4bool fValidTimes
Definition: G4Timer.hh:126
tms fStartTimes
Definition: G4Timer.hh:128
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76
tms fEndTimes
Definition: G4Timer.hh:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsValid()

G4bool G4Timer::IsValid ( ) const
inline
Here is the caller graph for this function:

◆ Start()

void G4Timer::Start ( )
inline
Here is the caller graph for this function:

◆ Stop()

void G4Timer::Stop ( )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ fEndRealTime

clock_t G4Timer::fEndRealTime
private

Definition at line 127 of file G4Timer.hh.

◆ fEndTimes

tms G4Timer::fEndTimes
private

Definition at line 128 of file G4Timer.hh.

◆ fStartRealTime

clock_t G4Timer::fStartRealTime
private

Definition at line 127 of file G4Timer.hh.

◆ fStartTimes

tms G4Timer::fStartTimes
private

Definition at line 128 of file G4Timer.hh.

◆ fValidTimes

G4bool G4Timer::fValidTimes
private

Definition at line 126 of file G4Timer.hh.


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