6 #ifndef TIMER_USE_STD_CLOCK
8 #include <sys/resource.h>
55 isRunning_ = startImmediately;
63 storedLastElapsed_ = 0.0;
98 return storedLastElapsed_;
109 sumElapsed_ += storedLastElapsed_;
120 double storedLastElapsed_;
123 #ifdef TIMER_USE_STD_CLOCK
126 cstart = std::clock();
129 double rawElapsed ()
const throw (TimerError)
131 return (std::clock()-cstart) /
static_cast<double>(CLOCKS_PER_SEC);
136 void rawReset() throw (TimerError)
139 if (getrusage(RUSAGE_SELF, &ru))
141 cstart = ru.ru_utime;
144 double rawElapsed ()
const throw (TimerError)
147 if (getrusage(RUSAGE_SELF, &ru))
149 return 1.0 * (ru.ru_utime.tv_sec - cstart.tv_sec) + (ru.ru_utime.tv_usec - cstart.tv_usec) / (1000.0 * 1000.0);
152 struct timeval cstart;