#include <Timer.h>
Public Methods | |
| Timer () | |
| void | startTiming () |
| Starts a timing. More... | |
| void | stopTiming () |
| Stops current timing. More... | |
| double | getTiming () |
| Gets the average timing. More... | |
| double | getLastTiming () |
| long | getTimeCount () |
| Returns the number of timings collected. More... | |
| void | reset () |
| double | wallclock () |
Definition at line 49 of file Timer.h.
|
|
Definition at line 52 of file Timer.h. References wallclock.
00053 {
00054 totalTime = 0;
00055 timeCount = 0;
00056 startTime = wallclock();
00057 endTime = startTime;
00058 }
|
|
|
Starts a timing.
Definition at line 61 of file Timer.h. References wallclock.
00062 { startTime = wallclock(); }
|
|
|
Stops current timing.
Definition at line 68 of file Timer.h. References wallclock.
00069 {
00070 endTime = wallclock();
00071 if (startTime == 0) // If we haven't called start then ignore
00072 { totalTime = 0; }
00073 else
00074 {
00075 lastTiming = (endTime - startTime);
00076 totalTime += lastTiming;
00077 timeCount++;
00078 }
00079 }
|
|
|
Gets the average timing.
Definition at line 82 of file Timer.h.
00083 { return (totalTime/(double)timeCount); }
|
|
|
Definition at line 85 of file Timer.h.
00086 { return lastTiming; }
|
|
|
Returns the number of timings collected.
Definition at line 89 of file Timer.h.
00090 { return timeCount; }
|
|
|
Definition at line 92 of file Timer.h. References wallclock.
00093 {
00094 totalTime = 0;
00095 timeCount = 0;
00096 startTime = wallclock();
00097 endTime = startTime;
00098 }
|
|
|
Definition at line 106 of file Timer.h. Referenced by reset, startTiming, stopTiming, and Timer.
00107 {
00108 double v;
00109 struct timeval tv;
00110
00111 vpr::System::gettimeofday(&tv);
00112
00113 v = (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0;
00114 return v;
00115 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002