18 template <
typename SCALAR =
double>
29 inline void start() { gettimeofday(&start_time, NULL); }
34 inline void stop() { gettimeofday(&stop_time, NULL); }
42 return (stop_time.tv_sec - start_time.tv_sec) + (stop_time.tv_usec - start_time.tv_usec) * 1e-6;
51 start_time.tv_sec = 0;
52 start_time.tv_usec = 0;
54 stop_time.tv_usec = 0;
58 struct timeval start_time;
59 struct timeval stop_time;
A timer ("stop watch") to record elapsed time based on the system clock.
Definition: Timer.h:19
SCALAR getElapsedTime() const
Get the elapsed time between calls to start() and stop()
Definition: Timer.h:40
Timer()
Default constructor.
Definition: Timer.h:23
void stop()
Trigger stop.
Definition: Timer.h:34
void start()
Trigger start.
Definition: Timer.h:29
CppAD::AD< CppAD::cg::CG< double > > SCALAR
void reset()
Resets the clock.
Definition: Timer.h:49