#include <Timer.hh>
Definition at line 106 of file Timer.hh.
◆ GetClockTime()
const char * PTL::Timer::GetClockTime |
( |
| ) |
|
|
inlinestatic |
Definition at line 155 of file Timer.hh.
156{
157 time_t rawtime;
159
160 time(&rawtime);
161 timeinfo = localtime(&rawtime);
162 return asctime(timeinfo);
163}
◆ GetRealElapsed()
double Timer::GetRealElapsed |
( |
| ) |
const |
Definition at line 85 of file Timer.cc.
86{
87 if(!fValidTimes)
88 {
89 throw std::runtime_error("Timer::GetRealElapsed() - "
90 "Timer not stopped or times not recorded!");
91 }
92 std::chrono::duration<double> diff = fEndRealTime - fStartRealTime;
93 return diff.count();
94}
Referenced by PTL::operator<<().
◆ GetSystemElapsed()
double Timer::GetSystemElapsed |
( |
| ) |
const |
Definition at line 99 of file Timer.cc.
100{
101 if(!fValidTimes)
102 {
103 throw std::runtime_error("Timer::GetSystemElapsed() - "
104 "Timer not stopped or times not recorded!");
105 }
106 double diff = fEndTimes.tms_stime - fStartTimes.tms_stime;
107 return diff / sysconf(_SC_CLK_TCK);
108}
Referenced by PTL::operator<<().
◆ GetUserElapsed()
double Timer::GetUserElapsed |
( |
| ) |
const |
Definition at line 113 of file Timer.cc.
114{
115 if(!fValidTimes)
116 {
117 throw std::runtime_error("Timer::GetUserElapsed() - "
118 "Timer not stopped or times not recorded!");
119 }
120 double diff = fEndTimes.tms_utime - fStartTimes.tms_utime;
121 return diff / sysconf(_SC_CLK_TCK);
122}
Referenced by PTL::operator<<().
◆ IsValid()
bool PTL::Timer::IsValid |
( |
| ) |
const |
|
inline |
◆ Start()
void PTL::Timer::Start |
( |
| ) |
|
|
inline |
Definition at line 133 of file Timer.hh.
134{
135 fValidTimes = false;
136 times(&fStartTimes);
137 fStartRealTime = clock_type::now();
138}
◆ Stop()
void PTL::Timer::Stop |
( |
| ) |
|
|
inline |
Definition at line 141 of file Timer.hh.
142{
143 times(&fEndTimes);
144 fEndRealTime = clock_type::now();
145 fValidTimes = true;
146}
The documentation for this class was generated from the following files: