6 #ifndef TIMER_USE_STD_CLOCK
8 #include <sys/resource.h>
60 isRunning_ = startImmediately;
68 storedLastElapsed_ = 0.0;
103 return storedLastElapsed_;
114 sumElapsed_ += storedLastElapsed_;
125 double storedLastElapsed_;
128 #ifdef TIMER_USE_STD_CLOCK
131 cstart = std::clock();
134 double rawElapsed ()
const throw (TimerError)
136 return (std::clock()-cstart) /
static_cast<double>(CLOCKS_PER_SEC);
141 void rawReset() throw (TimerError)
144 if (getrusage(RUSAGE_SELF, &ru))
146 cstart = ru.ru_utime;
149 double rawElapsed ()
const throw (TimerError)
152 if (getrusage(RUSAGE_SELF, &ru))
154 return 1.0 * (ru.ru_utime.tv_sec - cstart.tv_sec) + (ru.ru_utime.tv_usec - cstart.tv_usec) / (1000.0 * 1000.0);
157 struct timeval cstart;