An object Timer gives information on the CPU time of long-time computations.
More...
#include <Timer.h>
|
| Timer () |
| Constructor of Timer class. Initialize timer. More...
|
|
void | resetStart () |
| Resets time and start. More...
|
|
void | check () |
| Adds CPU time and real time to their buffers and resets. For long computations, it is recommended to do this operation at least once per iteration. More...
|
|
void | start () |
| Starts timer. More...
|
|
double | stop () |
| Stop timer and, if asked, returns CPU time from previous start in seconds. More...
|
|
double | CPUTime () |
| Returns CPU time from previous start in seconds. More...
|
|
double | realTime () |
| Returns real time from previous start in seconds. More...
|
|
void | add (double cpuTime, double realTime) |
| Adds time to buffer (only when a computation is restarted). More...
|
|
An object Timer gives information on the CPU time of long-time computations.
Constructor of Timer class. Initialize timer.
32 StartCPUTime = clock();
void Timer::add |
( |
double |
cpuTime, |
|
|
double |
realTime |
|
) |
| |
Adds time to buffer (only when a computation is restarted).
- Parameters
-
cpuTime | CPU time |
realTime | Real time |
- Returns
- void
double realTime()
Returns real time from previous start in seconds.
Definition: Timer.cpp:148
Adds CPU time and real time to their buffers and resets. For long computations, it is recommended to do this operation at least once per iteration.
- Returns
- void
111 EndCPUTime = clock();
112 sumCPUtime += double((
unsigned long int)EndCPUTime-StartCPUTime)/ (
unsigned long int)CLOCKS_PER_SEC;
113 StartCPUTime = EndCPUTime;
double Timer::CPUTime |
( |
| ) |
|
Returns CPU time from previous start in seconds.
- Returns
- double
133 EndCPUTime = clock();
134 return sumCPUtime+double((
unsigned long int)EndCPUTime-StartCPUTime)/ (
unsigned long int)CLOCKS_PER_SEC;
double Timer::realTime |
( |
| ) |
|
Returns real time from previous start in seconds.
- Returns
- double
160 return sumRealtime+difftime(EndRealTime,StartRealTime);
void Timer::resetStart |
( |
| ) |
|
Resets time and start.
- Returns
- void
48 StartCPUTime = clock();
Starts timer.
- Returns
- void
64 StartCPUTime = clock();
Stop timer and, if asked, returns CPU time from previous start in seconds.
- Returns
- double
90 sumCPUtime += double((
unsigned long int)EndCPUTime-StartCPUTime)/ (
unsigned long int)CLOCKS_PER_SEC;
91 sumRealtime += difftime(EndRealTime,StartRealTime);
The documentation for this class was generated from the following files: