4 #ifndef TIMER_USE_STD_CLOCK 6 #include <sys/resource.h> 53 #ifdef TIMER_USE_STD_CLOCK 54 cstart = std::clock();
57 if (getrusage(RUSAGE_SELF, &ru))
66 #ifdef TIMER_USE_STD_CLOCK 67 return (std::clock()-cstart) /
static_cast<double>(CLOCKS_PER_SEC);
70 if (getrusage(RUSAGE_SELF, &ru))
72 return 1.0 * (ru.ru_utime.tv_sec - cstart.tv_sec) + (ru.ru_utime.tv_usec - cstart.tv_usec) / (1000.0 * 1000.0);
77 #ifdef TIMER_USE_STD_CLOCK 80 struct timeval cstart;
#define HDNUM_THROW(E, m)
Definition: exceptions.hh:86
void reset()
Reset timer.
Definition: timer.hh:51
Default exception class for OS errors.
Definition: exceptions.hh:139
Exception thrown by the Timer class
Definition: timer.hh:26
A few common exception classes.
A simple stop watch.
Definition: timer.hh:41
Timer()
A new timer, start immediately.
Definition: timer.hh:45
Definition: densematrix.hh:21
double elapsed() const
Get elapsed user-time in seconds.
Definition: timer.hh:64